summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/psycopg2.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/psycopg2.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/psycopg2.py60
1 files changed, 1 insertions, 59 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/psycopg2.py b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
index b1d27c6fa..a52eacd8b 100644
--- a/lib/sqlalchemy/dialects/postgresql/psycopg2.py
+++ b/lib/sqlalchemy/dialects/postgresql/psycopg2.py
@@ -323,57 +323,6 @@ on the way in and coerce from bytes on the way back, using the value of the
SQLAlchemy's own unicode encode/decode functionality is steadily becoming
obsolete as most DBAPIs now support unicode fully.
-Bound Parameter Styles
-----------------------
-
-The default parameter style for the psycopg2 dialect is "pyformat", where
-SQL is rendered using ``%(paramname)s`` style. This format has the limitation
-that it does not accommodate the unusual case of parameter names that
-actually contain percent or parenthesis symbols; as SQLAlchemy in many cases
-generates bound parameter names based on the name of a column, the presence
-of these characters in a column name can lead to problems.
-
-There are two solutions to the issue of a :class:`_schema.Column`
-that contains
-one of these characters in its name. One is to specify the
-:paramref:`.schema.Column.key` for columns that have such names::
-
- measurement = Table('measurement', metadata,
- Column('Size (meters)', Integer, key='size_meters')
- )
-
-Above, an INSERT statement such as ``measurement.insert()`` will use
-``size_meters`` as the parameter name, and a SQL expression such as
-``measurement.c.size_meters > 10`` will derive the bound parameter name
-from the ``size_meters`` key as well.
-
-.. versionchanged:: 1.0.0 - SQL expressions will use
- :attr:`_schema.Column.key`
- as the source of naming when anonymous bound parameters are created
- in SQL expressions; previously, this behavior only applied to
- :meth:`_schema.Table.insert` and :meth:`_schema.Table.update`
- parameter names.
-
-The other solution is to use a positional format; psycopg2 allows use of the
-"format" paramstyle, which can be passed to
-:paramref:`_sa.create_engine.paramstyle`::
-
- engine = create_engine(
- 'postgresql://scott:tiger@localhost:5432/test', paramstyle='format')
-
-With the above engine, instead of a statement like::
-
- INSERT INTO measurement ("Size (meters)") VALUES (%(Size (meters))s)
- {'Size (meters)': 1}
-
-we instead see::
-
- INSERT INTO measurement ("Size (meters)") VALUES (%s)
- (1, )
-
-Where above, the dictionary style is converted into a tuple with positional
-style.
-
Transactions
------------
@@ -648,14 +597,7 @@ class PGExecutionContext_psycopg2(PGExecutionContext):
class PGCompiler_psycopg2(PGCompiler):
- def bindparam_string(self, name, **kw):
- if "%" in name and not kw.get("post_compile", False):
- # psycopg2 will not allow a percent sign in a
- # pyformat parameter name even if it is doubled
- kw["escaped_from"] = name
- name = name.replace("%", "P")
-
- return PGCompiler.bindparam_string(self, name, **kw)
+ pass
class PGIdentifierPreparer_psycopg2(PGIdentifierPreparer):