Example #1
0
    def __init__(self, dbtype, db, tablename, inc_rex=False):
        DatabaseHandler.__init__(self, dbtype, db)
        tablename = self.resolve_table(tablename)

        DatabaseConstraintCalculator.__init__(self, tablename)
        BaseConstraintDiscoverer.__init__(self, inc_rex=inc_rex)
        self.tablename = tablename
Example #2
0
 def test_sqlite_connection_from_file(self):
     connfile = os.path.join(TESTDATA_DIR, 'sqlite.conn')
     db = database_connection(conn=connfile)
     dbh = DatabaseHandler('sqlite', db)
     elements = dbh.resolve_table('elements')
     self.assertTrue(dbh.check_table_exists(elements))
     self.assertFalse(dbh.check_table_exists('does_not_exist'))
Example #3
0
 def test_sqlite_connection_from_file(self):
     connfile = os.path.join(TESTDATA_DIR, 'sqlite.conn')
     db = database_connection(conn=connfile)
     dbh = DatabaseHandler('sqlite', db)
     elements = dbh.resolve_table('elements')
     self.assertTrue(dbh.check_table_exists(elements))
     self.assertFalse(dbh.check_table_exists('does_not_exist'))
Example #4
0
    def __init__(self, dbtype, db, tablename, inc_rex=False, seed=None):
        DatabaseHandler.__init__(self, dbtype, db)
        tablename = self.resolve_table(tablename)

        DatabaseConstraintCalculator.__init__(self, tablename)
        BaseConstraintDiscoverer.__init__(self, inc_rex=inc_rex, seed=seed)
        self.tablename = tablename
Example #5
0
    def __init__(self,
                 dbtype,
                 db,
                 tablename,
                 epsilon=None,
                 type_checking='strict',
                 testing=False):
        """
        Inputs:

            *dbtype*:
                    Type of database.
            *db*:
                    A DB-API database connection object (for example, as
                    obtained from a call to pgdb.connect() for PostGreSQL
                    or as a call to MySQLdb.connect() for MySQL).
            *tablename*:
                    A table name, referring to a table that exists in the
                    database and is accessible. It can either be a simple
                    name, or a schema-qualified name of the form `schema.name`.
        """
        DatabaseHandler.__init__(self, dbtype, db)
        tablename = self.resolve_table(tablename)

        DatabaseConstraintCalculator.__init__(self, tablename, testing)
        DatabaseConstraintDetector.__init__(self, tablename)
        BaseConstraintVerifier.__init__(self,
                                        epsilon=epsilon,
                                        type_checking=type_checking)
Example #6
0
    def __init__(self, dbtype, db, tablename, epsilon=None,
                 type_checking='strict', testing=False):
        """
        Inputs:

            *dbtype*:
                    Type of database.
            *db*:
                    A DB-API database connection object (as obtained from
                    a call to the connect() method on the underlying database
                    driver).
            *tablename*:
                    A table name, referring to a table that exists in the
                    database and is accessible. It can either be a simple
                    name, or a schema-qualified name of the form `schema.name`.
        """
        DatabaseHandler.__init__(self, dbtype, db)
        tablename = self.resolve_table(tablename)

        DatabaseConstraintCalculator.__init__(self, tablename, testing)
        DatabaseConstraintDetector.__init__(self, tablename)
        BaseConstraintVerifier.__init__(self, epsilon=epsilon,
                                        type_checking=type_checking)
Example #7
0
 def setUpClass(cls):
     dbfile = os.path.join(TESTDATA_DIR, 'example.db')
     db = database_connection(dbtype='sqlite', db=dbfile)
     cls.dbh = DatabaseHandler('sqlite', db)
Example #8
0
 def setUpClass(cls):
     cls.db = database_connection(dbtype='mysql')
     cls.dbh = DatabaseHandler('mysql', cls.db)
Example #9
0
 def setUpClass(cls):
     cls.db = database_connection(dbtype='postgres')
     cls.dbh = DatabaseHandler('postgres', cls.db)
Example #10
0
 def setUpClass(cls):
     db = database_connection(dbtype='mongodb')
     cls.dbh = DatabaseHandler('mongodb', db)