summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/base.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-04-27 19:53:57 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-04-27 19:53:57 -0400
commit4b614b9b35cd2baddb7ca67c04bee5d70ec6a172 (patch)
tree7483cd269f5823f903f96709eb864fff9b6d9383 /lib/sqlalchemy/dialects/postgresql/base.py
parent9716a5c45e6185c5871555722d8495880f0e8c7a (diff)
downloadsqlalchemy-4b614b9b35cd2baddb7ca67c04bee5d70ec6a172.tar.gz
- the raw 2to3 run
- went through examples/ and cleaned out excess list() calls
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/base.py61
1 files changed, 32 insertions, 29 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py
index 1acdb57b9..992995434 100644
--- a/lib/sqlalchemy/dialects/postgresql/base.py
+++ b/lib/sqlalchemy/dialects/postgresql/base.py
@@ -1419,7 +1419,7 @@ class PGDialect(default.DefaultDialect):
query,
bindparams=[
sql.bindparam(
- 'schema', unicode(schema.lower()),
+ 'schema', str(schema.lower()),
type_=sqltypes.Unicode)]
)
)
@@ -1435,7 +1435,7 @@ class PGDialect(default.DefaultDialect):
"n.oid=c.relnamespace where n.nspname=current_schema() and "
"relname=:name",
bindparams=[
- sql.bindparam('name', unicode(table_name),
+ sql.bindparam('name', str(table_name),
type_=sqltypes.Unicode)]
)
)
@@ -1447,9 +1447,9 @@ class PGDialect(default.DefaultDialect):
"relname=:name",
bindparams=[
sql.bindparam('name',
- unicode(table_name), type_=sqltypes.Unicode),
+ str(table_name), type_=sqltypes.Unicode),
sql.bindparam('schema',
- unicode(schema), type_=sqltypes.Unicode)]
+ str(schema), type_=sqltypes.Unicode)]
)
)
return bool(cursor.first())
@@ -1463,7 +1463,7 @@ class PGDialect(default.DefaultDialect):
"n.nspname=current_schema() "
"and relname=:name",
bindparams=[
- sql.bindparam('name', unicode(sequence_name),
+ sql.bindparam('name', str(sequence_name),
type_=sqltypes.Unicode)
]
)
@@ -1475,10 +1475,10 @@ class PGDialect(default.DefaultDialect):
"n.oid=c.relnamespace where relkind='S' and "
"n.nspname=:schema and relname=:name",
bindparams=[
- sql.bindparam('name', unicode(sequence_name),
+ sql.bindparam('name', str(sequence_name),
type_=sqltypes.Unicode),
sql.bindparam('schema',
- unicode(schema), type_=sqltypes.Unicode)
+ str(schema), type_=sqltypes.Unicode)
]
)
)
@@ -1488,9 +1488,9 @@ class PGDialect(default.DefaultDialect):
def has_type(self, connection, type_name, schema=None):
bindparams = [
sql.bindparam('typname',
- unicode(type_name), type_=sqltypes.Unicode),
+ str(type_name), type_=sqltypes.Unicode),
sql.bindparam('nspname',
- unicode(schema), type_=sqltypes.Unicode),
+ str(schema), type_=sqltypes.Unicode),
]
if schema is not None:
query = """
@@ -1546,9 +1546,9 @@ class PGDialect(default.DefaultDialect):
""" % schema_where_clause
# Since we're binding to unicode, table_name and schema_name must be
# unicode.
- table_name = unicode(table_name)
+ table_name = str(table_name)
if schema is not None:
- schema = unicode(schema)
+ schema = str(schema)
s = sql.text(query, bindparams=[
sql.bindparam('table_name', type_=sqltypes.Unicode),
sql.bindparam('schema', type_=sqltypes.Unicode)
@@ -1570,13 +1570,14 @@ class PGDialect(default.DefaultDialect):
"""
rp = connection.execute(s)
# what about system tables?
- # Py3K
- #schema_names = [row[0] for row in rp \
- # if not row[0].startswith('pg_')]
- # Py2K
- schema_names = [row[0].decode(self.encoding) for row in rp \
+# start Py3K
+ schema_names = [row[0] for row in rp \
if not row[0].startswith('pg_')]
- # end Py2K
+# end Py3K
+# start Py2K
+# schema_names = [row[0].decode(self.encoding) for row in rp \
+# if not row[0].startswith('pg_')]
+# end Py2K
return schema_names
@reflection.cache
@@ -1587,7 +1588,7 @@ class PGDialect(default.DefaultDialect):
current_schema = self.default_schema_name
result = connection.execute(
- sql.text(u"SELECT relname FROM pg_class c "
+ sql.text("SELECT relname FROM pg_class c "
"WHERE relkind = 'r' "
"AND '%s' = (select nspname from pg_namespace n "
"where n.oid = c.relnamespace) " %
@@ -1610,12 +1611,13 @@ class PGDialect(default.DefaultDialect):
AND '%(schema)s' = (select nspname from pg_namespace n
where n.oid = c.relnamespace)
""" % dict(schema=current_schema)
- # Py3K
- #view_names = [row[0] for row in connection.execute(s)]
- # Py2K
- view_names = [row[0].decode(self.encoding)
- for row in connection.execute(s)]
- # end Py2K
+# start Py3K
+ view_names = [row[0] for row in connection.execute(s)]
+# end Py3K
+# start Py2K
+# view_names = [row[0].decode(self.encoding)
+# for row in connection.execute(s)]
+# end Py2K
return view_names
@reflection.cache
@@ -1632,11 +1634,12 @@ class PGDialect(default.DefaultDialect):
rp = connection.execute(sql.text(s),
view_name=view_name, schema=current_schema)
if rp:
- # Py3K
- #view_def = rp.scalar()
- # Py2K
- view_def = rp.scalar().decode(self.encoding)
- # end Py2K
+# start Py3K
+ view_def = rp.scalar()
+# end Py3K
+# start Py2K
+# view_def = rp.scalar().decode(self.encoding)
+# end Py2K
return view_def
@reflection.cache