Beispiel #1
0
 def test_dbsync(self):
     #DBSync().serializer().syncer().validator().start()
     engine = create_engine(
         'oracle://*****:*****@10.1.253.15:1521/orcl', echo=True)
     rdbms = DatabaseStore(engine)
     local_file = LocalStore('data')
     ThreadPoolSyncer(rdbms, local_file).sync()
Beispiel #2
0
    def test_select(self):
        _where = "name = 'jack'"

        full_table = DatabaseStore(self.__engine, "users")
        self.assertEqual(full_table.sql(), "SELECT * \nFROM users")

        full_table_with_where = DatabaseStore(self.__engine, "users", where=_where)
        print full_table_with_where.sql()

        full_table_with_where_and_split_by = DatabaseStore(self.__engine, "users", where=_where)
Beispiel #3
0
class DatabaseStoreTestCase(unittest.TestCase):

    def setUp(self):
        self.__engine = get_sample_data()
        self.__database = DatabaseStore(self.__engine, "users")

    def test_something(self):
        self.assertEqual(True, False)


    def test_splits(self):
        pass


    def test_select(self):
        _where = "name = 'jack'"

        full_table = DatabaseStore(self.__engine, "users")
        self.assertEqual(full_table.sql(), "SELECT * \nFROM users")

        full_table_with_where = DatabaseStore(self.__engine, "users", where=_where)
        print full_table_with_where.sql()

        full_table_with_where_and_split_by = DatabaseStore(self.__engine, "users", where=_where)

    def test_select_split_by(self):
        full_table_with_split_by = DatabaseStore(self.__engine, "users")
        print full_table_with_split_by.__select_with_split_by("2015-05-10", "2015-05-11")

    def test_count(self):
        print self.__database.count()

    def test_split(self):
        print self.__database.split(3)

    def test_get(self):
        yestoday  = DatabaseStore(self.__engine, "users", where="create_at > '2015-05-11'")
        for row in yestoday.get():
            print row


    def test_select_incr(self):
        print self.__database._select_incr(create_column='createtime', create_start_time='2015-10-11 00:00:00',
                                     create_end_time='2015-10-12 00:00:00', update_column='updatetime',
                                     update_start_time='2015-10-11 00:00:00', update_end_time='2015-10-12 00:00:00')
Beispiel #4
0
 def test_get(self):
     yestoday  = DatabaseStore(self.__engine, "users", where="create_at > '2015-05-11'")
     for row in yestoday.get():
         print row
Beispiel #5
0
 def test_select_split_by(self):
     full_table_with_split_by = DatabaseStore(self.__engine, "users")
     print full_table_with_split_by.__select_with_split_by("2015-05-10", "2015-05-11")
Beispiel #6
0
 def setUp(self):
     self.__engine = get_sample_data()
     self.__database = DatabaseStore(self.__engine, "users")
Beispiel #7
0
 def test_base(self):
     source = DatabaseStore(get_sample_data(), "users")
     target = LocalStore("data")
     sync_data(source, target, BaseSerializer())
Beispiel #8
0
 def setUp(self):
     self._full_table = DatabaseStore(get_sample_data(), "users")