.. changelog::
:version: 1.0.9
+ .. change::
+ :tags: bug, sybase
+ :tickets: 3508, 3509
+
+ Fixed two issues regarding Sybase reflection, allowing tables
+ without primary keys to be reflected as well as ensured that
+ a SQL statement involved in foreign key detection is pre-fetched up
+ front to avoid driver issues upon nested queries. Fixes here
+ courtesy Eugene Zapolsky; note that we cannot currently test
+ Sybase to locally verify these changes.
+
.. change::
:tags: bug, postgresql
:pullreq: github:190
FROM sysreferences r JOIN sysobjects o on r.tableid = o.id
WHERE r.tableid = :table_id
""")
- referential_constraints = connection.execute(REFCONSTRAINT_SQL,
- table_id=table_id)
+ referential_constraints = connection.execute(
+ REFCONSTRAINT_SQL, table_id=table_id).fetchall()
REFTABLE_SQL = text("""
SELECT o.name AS name, u.name AS 'schema'
results.close()
constrained_columns = []
- for i in range(1, pks["count"] + 1):
- constrained_columns.append(pks["pk_%i" % (i,)])
- return {"constrained_columns": constrained_columns,
- "name": pks["name"]}
+ if pks:
+ for i in range(1, pks["count"] + 1):
+ constrained_columns.append(pks["pk_%i" % (i,)])
+ return {"constrained_columns": constrained_columns,
+ "name": pks["name"]}
+ else:
+ return {"constrained_columns": [], "name": None}
@reflection.cache
def get_schema_names(self, connection, **kw):