Beispiel #1
0
 def test_compare_get_foreign_keys_for_sql_and_odbc(self, schema, table,
                                                    engine_name):
     with self.engine_map[engine_name].begin() as c:
         if schema is None:
             c.execute("OPEN SCHEMA %s" % self.schema_2)
         dialect = EXADialect()
         foreign_keys_fallback = dialect.get_foreign_keys(
             connection=c,
             table_name=table,
             schema=schema,
             use_sql_fallback=True)
         foreign_keys_odbc = dialect.get_foreign_keys(connection=c,
                                                      table_name=table,
                                                      schema=schema)
         assert str(foreign_keys_fallback) == str(foreign_keys_odbc)
 def test_get_foreign_keys_table_name_none(self, use_sql_fallback,
                                           engine_name):
     with self.engine_map[engine_name].begin() as c:
         dialect = EXADialect()
         foreign_keys = dialect.get_foreign_keys(
             connection=c,
             schema=self.schema,
             table_name=None,
             use_sql_fallback=use_sql_fallback)
         assert foreign_keys == []
Beispiel #3
0
    def test_get_foreign_keys(self, use_sql_fallback, engine_name):
        with self.engine_map[engine_name].begin() as c:
            dialect = EXADialect()
            foreign_keys = dialect.get_foreign_keys(
                connection=c,
                schema=self.schema,
                table_name="s",
                use_sql_fallback=use_sql_fallback)
            expected = [{
                'name': 'fk_test',
                'constrained_columns': ['fid1', 'fid2'],
                'referred_schema': 'test_get_metadata_functions_schema',
                'referred_table': 't',
                'referred_columns': ['pid1', 'pid2']
            }]

            assert foreign_keys == expected
 def without_fallback(session2, schema, table):
     dialect = EXADialect()
     dialect.get_foreign_keys(session2,
                              table_name=table,
                              schema=schema,
                              use_sql_fallback=False)