summaryrefslogtreecommitdiff
path: root/test/sql/test_quote.py
Commit message (Collapse)AuthorAgeFilesLines
* resolves #5333 typo correction 'explcit' should be 'explicit'.RamonWill2020-07-041-2/+2
|
* Deprecate plain string in execute and introduce `exec_driver_sql`Federico Caselli2020-03-211-13/+17
| | | | | | | | | | | | | | | Execution of literal sql string is deprecated in the :meth:`.Connection.execute` and a warning is raised when used stating that it will be coerced to :func:`.text` in a future release. To execute a raw sql string the new connection method :meth:`.Connection.exec_driver_sql` was added, that will retain the previous behavior, passing the string to the DBAPI driver unchanged. Usage of scalar or tuple positional parameters in :meth:`.Connection.execute` is also deprecated. Fixes: #4848 Fixes: #5178 Change-Id: I2830181054327996d594f7f0d59c157d477c3aa9
* Use default repr() for quoted_name under python 3Mike Bayer2019-10-241-0/+49
| | | | | | | | | | | | | | | | | | | | | Changed the ``repr()`` of the :class:`.quoted_name` construct to use regular string repr() under Python 3, rather than running it through "backslashreplace" escaping, which can be misleading. Modified the approach of "name normalization" for the Oracle and Firebird dialects, which converts from the UPPERCASE-as-case-insensitive convention of these dialects into lowercase-as-case-insensitive for SQLAlchemy, to not automatically apply the :class:`.quoted_name` construct to a name that matches itself under upper or lower case conversion, as is the case for many non-european characters. All names used within metadata structures are converted to :class:`.quoted_name` objects in any case; the change here would only affect the output of some inspection functions. Moved name normalize to be under default dialect, added test coverage in test/sql/test_quote.py Fixes: #4931 Change-Id: Ic121b20e07249824710a54423e321d94a425362f
* Add _alembic_quote method to format_constraint()Mike Bayer2019-10-131-0/+28
| | | | | | | | | | | | | | Alembic needs a portable way of getting at the name of an index without quoting being applied. As we would like the indexes created by the Column index=True flag to support deferred index names, supply a function that delivers this for Alembic without it having to dig too deeply into the internals. the _alembic_quote flag may be made public at a later time, however as we've been through many quoting flags that are difficult to get rid of, try to be conservative to start. Change-Id: I184adaeae26c2e75093aaea5ebe01a3815cadb08
* Modernize internal reflectionMike Bayer2019-08-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | - Deprecated remaining engine-level introspection and utility methods including :meth:`.Engine.run_callable`, :meth:`.Engine.transaction`, :meth:`.Engine.table_names`, :meth:`.Engine.has_table`. The utility methods are superseded by modern context-manager patterns, and the table introspection tasks are suited by the :class:`.Inspector` object. - The internal dialect method ``Dialect.reflecttable`` has been removed. A review of third party dialects has not found any making use of this method, as it was already documented as one that should not be used by external dialects. Additionally, the private ``Engine._run_visitor`` method is also removed. - The long-deprecated ``Inspector.get_table_names.order_by`` parameter has been removed. - The :paramref:`.Table.autoload_with` parameter now accepts an :class:`.Inspector` object directly, as well as any :class:`.Engine` or :class:`.Connection` as was the case before. Fixes: #4755 Change-Id: Iec3a8b0f3e298ba87d532b16fac1e1132f464e21
* SelectBase no longer a FromClauseMike Bayer2019-07-061-48/+0
| | | | | | | | | | | | | | | | | | | | As part of the SQLAlchemy 2.0 migration project, a conceptual change has been made to the role of the :class:`.SelectBase` class hierarchy, which is the root of all "SELECT" statement constructs, in that they no longer serve directly as FROM clauses, that is, they no longer subclass :class:`.FromClause`. For end users, the change mostly means that any placement of a :func:`.select` construct in the FROM clause of another :func:`.select` requires first that it be wrapped in a subquery first, which historically is through the use of the :meth:`.SelectBase.alias` method, and is now also available through the use of :meth:`.SelectBase.subquery`. This was usually a requirement in any case since several databases don't accept unnamed SELECT subqueries in their FROM clause in any case. See the documentation in this change for lots more detail. Fixes: #4617 Change-Id: I0f6174ee24b9a1a4529168e52e855e12abd60667
* Turn off the is_literal flag when proxying literal_column() to LabelMike Bayer2019-06-151-0/+102
| | | | | | | | | | | | | | | | | | | Fixed a series of quoting issues which all stemmed from the concept of the :func:`.literal_column` construct, which when being "proxied" through a subquery to be referred towards by a label that matches its text, the label would not have quoting rules applied to it, even if the string in the :class:`.Label` were set up as a :class:`.quoted_name` construct. Not applying quoting to the text of the :class:`.Label` is a bug because this text is strictly a SQL identifier name and not a SQL expression, and the string should not have quotes embedded into it already unlike the :func:`.literal_column` which it may be applied towards. The existing behavior of a non-labeled :func:`.literal_column` being propagated as is on the outside of a subquery is maintained in order to help with manual quoting schemes, although it's not clear if valid SQL can be generated for such a construct in any case. Fixes: #4730 Change-Id: I300941f27872fc4298c74a1d1ed65aef1a5cdd82
* Post black reformattingMike Bayer2019-01-061-29/+31
| | | | | | | | | | | | | Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
* Run black -l 79 against all source filesMike Bayer2019-01-061-393/+447
| | | | | | | | | | | | | | This is a straight reformat run using black as is, with no edits applied at all. The black run will format code consistently, however in some cases that are prevalent in SQLAlchemy code it produces too-long lines. The too-long lines will be resolved in the following commit that will resolve all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
* Make column-level collation quoting dialect-specificMike Bayer2018-01-121-2/+9
| | | | | | | | | | | | | Fixed regression in 1.2 where newly repaired quoting of collation names in :ticket:`3785` breaks SQL Server, which explicitly does not understand a quoted collation name. Whether or not mixed-case collation names are quoted or not is now deferred down to a dialect-level decision so that each dialect can prepare these identifiers directly. Change-Id: Iaf0a8123d9bf4711219e320896bb28c5d2649304 Fixes: #4154
* Double percent signs based on paramstyle, not dialectMike Bayer2017-04-051-6/+6
| | | | | | | | | | | | This patch moves the "doubling" of percent signs into the base compiler and makes it completely a product of whether or not the paramstyle is format/pyformat or not. Without this paramstyle, percent signs are not doubled across text(), literal_column(), and column(). Change-Id: Ie2f278ab1dbb94b5078f85c0096d74dbfa049197 Fixes: #3740
* Treat collation names as identifiersMike Bayer2017-03-231-0/+17
| | | | | | | | | | | The expression used for COLLATE as rendered by the column-level :func:`.expression.collate` and :meth:`.ColumnOperators.collate` is now quoted as an identifier when the name is case sensitive, e.g. has uppercase characters. Note that this does not impact type-level collation, which is already quoted. Change-Id: I83d5d9cd1e66a4f20b96303bb84c5f360d5d6a1a Fixes: #3785
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-071-1/+3
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* - update the flake8 rules againMike Bayer2014-07-181-221/+242
| | | | - apply autopep8 + manual fixes to most of test/sql/
* - Fixed regression introduced in 0.9 where new "ORDER BY <labelname>"Mike Bayer2014-04-101-0/+9
| | | | | | feature from :ticket:`1068` would not apply quoting rules to the label name as rendered in the ORDER BY. fix #3020, re: #1068
* - rename __multiple__ to __backend__, and apply __backend__ to a large ↵Mike Bayer2014-03-241-3/+24
| | | | | | number of tests. - move out logging tests from test_execute to test_logging
* - fix propagation of quote flag within _gen_label() so that if theMike Bayer2013-10-051-0/+13
| | | | | | name is already an instance of _anonymous_label(), we don't downgrade it to a plain quoted_name - fixes regression from [ticket:2812]. [ticket:2834]
* - A rework to the way that "quoted" identifiers are handled, in thatMike Bayer2013-08-271-4/+145
| | | | | | | | | | | | | | | | instead of relying upon various ``quote=True`` flags being passed around, these flags are converted into rich string objects with quoting information included at the point at which they are passed to common schema constructs like :class:`.Table`, :class:`.Column`, etc. This solves the issue of various methods that don't correctly honor the "quote" flag such as :meth:`.Engine.has_table` and related methods. The :class:`.quoted_name` object is a string subclass that can also be used explicitly if needed; the object will hold onto the quoting preferences passed and will also bypass the "name normalization" performed by dialects that standardize on uppercase symbols, such as Oracle, Firebird and DB2. The upshot is that the "uppercase" backends can now work with force-quoted names, such as lowercase-quoted names and new reserved words. [ticket:2812]
* Fixed bug in :class:`.CheckConstraint` DDL where the "quote" flag from aMike Bayer2013-07-171-0/+23
| | | | | :class:`.Column` object would not be propagated. Also in 0.8.3, 0.7.11. [ticket:2784]
* - the raw 2to3 runMike Bayer2013-04-271-5/+5
| | | | - went through examples/ and cleaned out excess list() calls
* - adjust this test for the ugly reality of the "name normalize" backends, ↵Mike Bayer2012-11-231-2/+16
| | | | | | | | where because we've decided that "lowercase" is the case insensitive casing, we can't distinguish between case insensitive/not on a database that returns case-insensitive names as UPPERCASE, for names that are UPPERCASE. [ticket:2615]
* just a pep8 pass before I play with these testsDiana Clarke2012-11-231-1/+1
|
* second pass: increasing coverage, and commenting the "why" certain things ↵Diana Clarke2012-11-221-140/+357
| | | | are being tested (when I know) b/c it wasn't initially clear to me why case was being toggled everywhere, etc.
* first pass cleaning up test_labels #2610Diana Clarke2012-11-211-81/+212
|
* this test class had 2 'test_labels' methods, just changing one of them to ↵Diana Clarke2012-11-211-1/+1
| | | | 'test_labels3' for now
* trying different approaches to test layout. in this one, the testing modulesMike Bayer2012-09-271-1/+2
| | | | | | | become an externally usable package but still remains within the main sqlalchemy parent package. in this system, we use kind of an ugly hack to get the noseplugin imported outside of the "sqlalchemy" package, while still making it available within sqlalchemy for usage by third party libraries.
* -whitespace bonanza, contdMike Bayer2012-07-281-7/+7
|
* - [bug] Added support for using the .keyMike Bayer2012-02-051-8/+8
| | | | | | | | | | | | of a Column as a string identifier in a result set row. The .key is currently listed as an "alternate" name for a column, and is superseded by the name of a column which has that key value as its regular name. For the next major release of SQLAlchemy we may reverse this precedence so that .key takes precedence, but this is not decided on yet. [ticket:2392]
* - move all the comments that got shoved below the fixture grabs back upMike Bayer2011-03-271-0/+1
|
* - remove test.sql._base, test.engine._base, test.orm._base, move those ↵Mike Bayer2011-03-271-2/+2
| | | | | | | classes to a new test.lib.fixtures module - move testing.TestBase to test.lib.fixtures - massive search and replace
* Informix and postgresql reserved words changes -- almost done.Jim Phares2011-03-151-0/+12
|
* make it more explicit in tests which dialect we want to use for thingsMike Bayer2011-02-111-0/+2
|
* - whitespace removal bonanzaMike Bayer2011-01-021-2/+2
|
* - ResultProxy and friends always reference the DBAPI connection at the same timeMike Bayer2010-12-051-1/+3
| | | | | | | | as the cursor. There is no reason for CursorFairy - the only use case would be, end-user is using the pool or pool.manage with DBAPI connections, uses a cursor, deferences the owning connection and continues using cursor. This is an almost nonexistent use case and isn't correct usage at a DBAPI level. Take out CursorFairy. - move the "check for a dot in the colname" logic out to the sqlite dialect.
* - move sqlalchemy.test to test.libMike Bayer2010-11-151-1/+1
|
* Because of changes to SQLAlchemy bind parameter placement, removed all ↵Brad Allen2010-03-171-3/+0
| | | | mxodbc test disabling statements having this pattern: @testing.crashes('mssql+mxodbc', """Invalid bind parameter placement:
* Disabling tests for mssql+mxodbc where mxODBC cursor.execute chokes on ↵Brad Allen2010-03-161-0/+4
| | | | invalid placement of bind parameter "?" within the SQL statement.
* fixed the illegal_initial_chars collection + unit test, [ticket:1659]Mike Bayer2010-01-211-2/+9
|
* merge 0.6 series to trunk.Mike Bayer2009-08-061-1/+1
|
* - unit tests have been migrated from unittest to nose.Mike Bayer2009-06-101-0/+210
See README.unittests for information on how to run the tests. [ticket:970]