Exemple #1
0
 def test_compare_get_pk_constraint_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)
         dialect = EXADialect()
         pk_constraint_fallback = dialect.get_pk_constraint(
             connection=c,
             table_name=table,
             schema=schema,
             use_sql_fallback=True)
         pk_constraint_odbc = dialect.get_pk_constraint(connection=c,
                                                        table_name=table,
                                                        schema=schema)
         assert str(pk_constraint_fallback) == str(pk_constraint_odbc)
Exemple #2
0
 def test_get_pk_constraint(self, use_sql_fallback, engine_name):
     with self.engine_map[engine_name].begin() as c:
         dialect = EXADialect()
         pk_constraint = dialect.get_pk_constraint(
             connection=c,
             schema=self.schema,
             table_name="t",
             use_sql_fallback=use_sql_fallback)
         assert pk_constraint["constrained_columns"] == ['pid1', 'pid2'] and \
                pk_constraint["name"].startswith("sys_")
 def test_get_pk_constraint_table_name_none(self, use_sql_fallback,
                                            engine_name):
     with self.engine_map[engine_name].begin() as c:
         dialect = EXADialect()
         pk_constraint = dialect.get_pk_constraint(
             connection=c,
             schema=self.schema,
             table_name=None,
             use_sql_fallback=use_sql_fallback)
         assert pk_constraint is None
 def with_fallback(session2, schema, table):
     dialect = EXADialect()
     dialect.get_pk_constraint(session2,
                               table_name=table,
                               schema=schema,
                               use_sql_fallback=True)