Skip to main content

Home/ HealthcareMetadata/ Group items tagged strategies

Rss Feed Group items tagged

Malcolm McRoberts

Google Groups - 0 views

  • There are several common strategies for document versioning. The strategy you select will depend on the trade-offs you want to make. Please note that MongoDB does not have any support for triggers. So a few of these methods will require that you be able to do multiple writes.
  • === Strategy 1: embed history === In theory, you can embed the history of a document inside of the document itself. This can even be done atomically.
  • === Strategy 2: write history to separate collection ===
  • ...2 more annotations...
  • ----- Both strategies can be enhanced by storing only the diffs.
  • Embedding:  + atomic change (especially with findAndModify)  - can result in large documents, may break the 16MB limit  - probably have to enhance code to avoid returning full hist when not necessary Separate collection:  + easier to write queries  - not atomic, needs two operations and Mongo doesn't have transactions  - more storage space (extra indexes on original docs) Hopefully that gets you working in the right direction.
Malcolm McRoberts

Databases integration testing strategies with Python | Julien Danjou - 0 views

  • import unittestimport osimport sqlalchemy import myapp class TestDB(unittest.TestCase): def setUp(self): url = os.getenv("DB_TEST_URL") if not url: self.skipTest("No database URL set") self.engine = sqlalchemy.create_engine(url)  def test_foobar(self): self.assertTrue(myapp.store_integer(self.engine, 42))
  • import unittestimport osimport sqlalchemy import myapp class TestDB(unittest.TestCase): def setUp(self): url = os.getenv("DB_TEST_URL") if not url: self.skipTest("No database URL set") self.engine = sqlalchemy.create_engine(url)  def test_foobar(self): self.assertTrue(myapp.store_integer(self.engine, 42))
  • import unittestimport osimport sqlalchemy import myapp class TestDB(unittest.TestCase): def setUp(self): url = os.getenv("DB_TEST_URL") if not url: self.skipTest("No database URL set") self.engine = sqlalchemy.create_engine(url)  def test_foobar(self): self.assertTrue(myapp.store_integer(self.engine, 42))
  • ...3 more annotations...
  • import unittestimport osimport sqlalchemy import myapp class TestDB(unittest.TestCase): def setUp(self): url = os.getenv("DB_TEST_URL") if not url: self.skipTest("No database URL set") self.engine = sqlalchemy.create_engine(url)  def test_foobar(self): self.assertTrue(myapp.store_integer(self.engine, 42))
  • import unittestimport osimport sqlalchemy import myapp class TestDB(unittest.TestCase): def setUp(self): url = os.getenv("DB_TEST_URL") if not url: self.skipTest("No database URL set") self.engine = sqlalchemy.create_engine(url)  def test_foobar(self): self.assertTrue(myapp.store_integer(self.engine, 42))
  • ("DB_TEST_URL") if not url: self.skipTest("No database URL set") self.engine = sqlalchemy.create_engine(url)  def test_foobar(self): self.assertTrue(myapp.store_integer(self.engine, 42))
1 - 2 of 2
Showing 20 items per page