- added an NVarchar type (produces NVARCHAR), also MSUnicode which provides Unicode-translation
for the NVarchar regardless of dialect convert_unicode setting.
- postgres:
+ - fix to the initial checkfirst for tables to take current schema into account [ticket:424]
- postgres has an optional "server_side_cursors=True" flag which will utilize
server side cursors. these are appropriate for fetching only partial results
and are necessary for working with very large unbounded result sets.
def dbapi(self):
return self.module
- def has_table(self, connection, table_name):
- # TODO: why are we case folding here ?
- cursor = connection.execute("""select relname from pg_class where lower(relname) = %(name)s""", {'name':table_name.lower()})
+ def has_table(self, connection, table_name, schema=None):
+ # seems like case gets folded in pg_class...
+ if schema is None:
+ cursor = connection.execute("""select relname from pg_class c join pg_namespace n on n.oid=c.relnamespace where n.nspname=current_schema() and relname=%(name)s""", {'name':table_name.lower()});
+ else:
+ cursor = connection.execute("""select relname from pg_class c join pg_namespace n on n.oid=c.relnamespace where n.nspname=%(schema)s and relname=%(name)s""", {'name':table_name.lower(), 'schema':schema});
return bool( not not cursor.rowcount )
def has_sequence(self, connection, sequence_name):