summaryrefslogtreecommitdiff
path: root/test/dialect/postgresql/test_reflection.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Use pg_get_constraintdef for CHECK constraint reflectionMike Bayer2019-01-241-0/+15
| | | | | | | | | Revised the query used when reflecting CHECK constraints to make use of the ``pg_get_constraintdef`` function, as the ``consrc`` column is being deprecated in PG 12. Thanks to John A Stevenson for the tip. Fixes: #4463 Change-Id: Ie0ee9bdfddb0635db72b35c2e2e4b27f154162fd
* Post black reformattingMike Bayer2019-01-061-28/+28
| | | | | | | | | | | | | 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-624/+826
| | | | | | | | | | | | | | 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
* Handle PostgreSQL enums in remote schemasMike Bayer2018-12-211-32/+99
| | | | | | | | | | | | | | | | | | Fixed issue where a :class:`.postgresql.ENUM` or a custom domain present in a remote schema would not be recognized within column reflection if the name of the enum/domain or the name of the schema required quoting. A new parsing scheme now fully parses out quoted or non-quoted tokens including support for SQL-escaped quotes. Fixed issue where multiple :class:`.postgresql.ENUM` objects referred to by the same :class:`.MetaData` object would fail to be created if multiple objects had the same name under different schema names. The internal memoization the Postgresql dialect uses to track if it has created a particular :class:`.postgresql.ENUM` in the database during a DDL creation sequence now takes schema name into account. Fixes: #4416 Change-Id: I8cf03069e10b12f409e9b6796e24fc5850979955
* Fix PostgreSQL reflection of domains expressed as arraysJakub Synowiec2018-12-011-2/+19
| | | | | | | | | Fixed issue where reflection of a PostgreSQL domain that is expressed as an array would fail to be recognized. Pull request courtesy Jakub Synowiec. Fixes: #4377 Change-Id: I252c79ca435b87d4d9172b1c84e0e74e789ef676 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4380
* Add reflection support for Postgresql partitioned tablesMike Bayer2018-10-011-0/+45
| | | | | | | | | Added rudimental support for reflection of Postgresql partitioned tables, e.g. that relkind='p' is added to reflection queries that return table information. Fixes: #4237 Change-Id: I66fd10b002e4ed21ea13b13a7e35a85f66bdea75
* Strip quotes from format_type in addition to other charactersMike Bayer2018-08-211-0/+35
| | | | | | | | | | Fixed bug in PostgreSQL ENUM reflection where a case-sensitive, quoted name would be reported by the query including quotes, which would not match a target column during table reflection as the quotes needed to be stripped off. Fixes: #4323 Change-Id: I668f3acccc578e58f23b70c82d31d5c1ec194913
* Test for EXCLUDE constraint duplicated indexMike Bayer2017-10-251-1/+33
| | | | | | | | | An EXCLUDE constraint makes an index just like a UNIQUE does; get_indexes() will receive this. Test that this works out the same way as it does for a UNIQUE. Change-Id: I02ac7cbbb1ca0d1fcdcdbe9a8b8bd1ffee3e496c Fixes: #4122
* Support Postgresql INTERVAL fields spec/reflectionMike Bayer2017-04-051-1/+59
| | | | | | | | | | | | | Added support for all possible "fields" identifiers when reflecting the Postgresql ``INTERVAL`` datatype, e.g. "YEAR", "MONTH", "DAY TO MINUTE", etc.. In addition, the :class:`.postgresql.INTERVAL` datatype itself now includes a new parameter :paramref:`.postgresql.INTERVAL.fields` where these qualifiers can be specified; the qualifier is also reflected back into the resulting datatype upon reflection / inspection. Change-Id: I33816e68c533b023e0632db6f4e73fefd2de4721 Fixes: #3959
* Implement comments for tables, columnsFrazer McLean2017-03-171-1/+1
| | | | | | | | | | | | | | Added support for SQL comments on :class:`.Table` and :class:`.Column` objects, via the new :paramref:`.Table.comment` and :paramref:`.Column.comment` arguments. The comments are included as part of DDL on table creation, either inline or via an appropriate ALTER statement, and are also reflected back within table reflection, as well as via the :class:`.Inspector`. Supported backends currently include MySQL, Postgresql, and Oracle. Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com> Fixes: #1546 Change-Id: Ib90683850805a2b4ee198e420dc294f32f15d35d
* Make all tests to be PEP8 compliantKhairi Hafsham2017-02-071-2/+2
| | | | | | | | tested using pycodestyle version 2.2.0 Fixes: #3885 Change-Id: I5df43adc3aefe318f9eeab72a078247a548ec566 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/343
* Don't set pg autoincrement if type affinity is not IntegerMike Bayer2016-10-201-0/+16
| | | | | | | | | | | | | | | Postgresql table reflection will ensure that the :paramref:`.Column.autoincrement` flag is set to False when reflecting a primary key column that is not of an :class:`.Integer` datatype, even if the default is related to an integer-generating sequence. This can happen if a column is created as SERIAL and the datatype is changed. The autoincrement flag can only be True if the datatype is of integer affinity in the 1.1 series. This bug is related to a test failure in downstream sqlalchemy_migrate. Change-Id: I40260e47e1927a1ac940538408983c943bbdba28 Fixes: #3835
* Support normal /materialized views in PG separatelySebastian Bank2016-06-061-1/+21
| | | | | | Fixes: #3588 Change-Id: Ifbfcab67375f289ddb5c4522f4b803cb8b7c34de Pull-request: https://github.com/zzzeek/sqlalchemy/pull/250
* Implemented CHECK constraint reflection for SQLite and PostgreSQLAlex Grönholm2016-06-011-0/+24
| | | | | | Co-Authored-By: Mike Bayer <mike_mp@zzzcomputing.com> Change-Id: Ie6cf2d2958d1c567324db9e08fef2d3186e97350 Pull-request: https://bitbucket.org/zzzeek/sqlalchemy/pull-requests/80
* Support "blank" schema when MetaData.schema is setMike Bayer2016-05-181-0/+23
| | | | | | | | | | | | | Previously, it was impossible to have a Table that has None for a schema name when the "schema" parameter on MetaData was set. A new symbol sqlalchemy.schema.BLANK_SCHEMA is added which indicates that the schema name should unconditionally be set to None. In particular, this value must be passed within cross-schema foreign key reflection, so that a Table which is in the "default" schema can be represented properly. Fixes: #3716 Change-Id: I3d24f99c22cded206c5379fd32a225e74edb7a8e
* - test fixes for metadata.enums value now being a listMike Bayer2016-02-021-1/+1
| | | | - modernize those tests as well
* - Added support for reflecting the source of materialized viewsMike Bayer2015-11-181-0/+10
| | | | | | to the Postgresql version of the :meth:`.Inspector.get_view_definition` method. fixes #3587
* - An adjustment to the new Postgresql feature of reflecting storageMike Bayer2015-07-241-0/+1
| | | | | | | | | options and USING of :ticket:`3455` released in 1.0.6, to disable the feature for Postgresql versions < 8.2 where the ``reloptions`` column is not provided; this allows Amazon Redshift to again work as it is based on an 8.0.x version of Postgresql. Fix courtesy Pete Hollobon. references #3455
* Fix typopr/183Pete Hollobon2015-06-221-1/+1
|
* - for #3455Mike Bayer2015-06-191-21/+36
| | | | | | | | | - changelog - versionadded + reflink for new pg storage parameters doc - pep8ing - add additional tests to definitely check that the Index object is created all the way with the opts we want fixes #3455
* Merge remote-tracking branch 'origin/pr/179' into pr179Mike Bayer2015-06-191-0/+39
|\
| * Add reflection of PostgreSQL index access methods (USING clause)pr/179Pete Hollobon2015-06-041-0/+19
| |
| * Add reflection of PostgreSQL index storage optionsPete Hollobon2015-06-041-0/+20
| |
* | - Repaired some typing and test issues related to the pypyMike Bayer2015-06-051-1/+1
|/ | | | | | | | | psycopg2cffi dialect, in particular that the current 2.7.0 version does not have native support for the JSONB type. The version detection for psycopg2 features has been tuned into a specific sub-version for psycopg2cffi. Additionally, test coverage has been enabled for the full series of psycopg2 features under psycopg2cffi. fixes #3439
* - Fixed bug where updated PG index reflection as a result ofMike Bayer2015-04-011-0/+1
| | | | | | | :ticket:`3184` would cause index operations to fail on Postgresql versions 8.4 and earlier. The enhancements are now disabled when using an older version of Postgresql. fixes #3343
* - The :meth:`.PGDialect.has_table` method will now query againstMike Bayer2014-12-041-0/+12
| | | | | | | | | | | ``pg_catalog.pg_table_is_visible(c.oid)``, rather than testing for an exact schema match, when the schema name is None; this so that the method will also illustrate that temporary tables are present. Note that this is a behavioral change, as Postgresql allows a non-temporary table to silently overwrite an existing temporary table of the same name, so this changes the behavior of ``checkfirst`` in that unusual scenario. fixes #3264
* - use provide_metadata for new unique constraint / index testsMike Bayer2014-10-041-23/+51
| | | | | | | | | | | | | | - add a test for PG reflection of unique index without any unique constraint - for PG, don't include 'duplicates_constraint' in the entry if the index does not actually mirror a constraint - use a distinct method for unique constraint reflection within table - catch unique constraint not implemented condition; this may be within some dialects and also is expected to be supported by Alembic tests - migration + changelogs for #3184 - add individual doc notes as well to MySQL, Postgreql fixes #3184
* Reflect unique constraints when reflecting a Table objectJohannes Erdfelt2014-09-171-2/+35
| | | | | | | | | | | | | | | Calls to reflect a table did not create any UniqueConstraint objects. The reflection core made no calls to get_unique_constraints and as a result, the sqlite dialect would never reflect any unique constraints. MySQL transparently converts unique constraints into unique indexes, but SQLAlchemy would reflect those as an Index object and as a UniqueConstraint. The reflection core will now deduplicate the unique constraints. PostgreSQL would reflect unique constraints as an Index object and as a UniqueConstraint object. The reflection core will now deduplicate the unique indexes.
* - repair get_foreign_table_names() for PGInsp/dialect levelpr128Mike Bayer2014-09-171-3/+22
| | | | | - repair get_view_names() - changelog + migration note
* - the actual round trip requires password authent set up for the user;Mike Bayer2014-09-171-25/+7
| | | | we don't actually need a round trip test here as we're only testing reflection.
* - break out and fix tests for materialized view and foreign tables. foreign ↵Mike Bayer2014-09-161-72/+86
| | | | tables not working
* Added documentation. Changed my mind - added get_foreign_table_names() only ↵pr/128Rodrigo Menezes2014-09-051-0/+6
| | | | to PGInspect and not in the Dialect. Added tests for PGInspect and removed a bunch of the old test scaffolding.
* Fixing some pep8s and adding get_foreign_tables.Rodrigo Menezes2014-09-031-6/+11
|
* Removed all mentions to postgresql_relkindRodrigo Menezes2014-08-261-22/+11
|
* Merge branch 'master' of https://github.com/rclmenezes/sqlalchemyRodrigo Menezes2014-08-141-0/+66
|\
| * - public method name is get_enums()Mike Bayer2014-08-131-12/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - return a list of dicts like other methods do - don't combine 'schema' with 'name', leave them separate - support '*' argument so that we can retrieve cross-schema if needed - remove "conn" argument - use bound parameters for 'schema' in SQL - order by schema, name, label - adapt _load_enums changes to column reflection - changelog - module docs for get_enums() - add drop of enums to --dropfirst
| * Public inspector method to load enum listpr/126Ilya Pekelny2014-08-081-0/+21
| | | | | | | | | | Provide opportunity to get enums list via an inspector instance public interface.
* | Added support for postgres_relkind.Rodrigo Menezes2014-08-141-1/+101
|/
* - flake8 all of test/dialect/postgresqlMike Bayer2014-07-251-136/+179
| | | | - add __backend__ to most tests so that pg8000 can start coming in
* - Fixed regression caused by release 0.8.5 / 0.9.3's compatibilityMike Bayer2014-03-251-1/+1
| | | | | | | | | enhancements where index reflection on Postgresql versions specific to only the 8.1, 8.2 series again broke, surrounding the ever problematic int2vector type. While int2vector supports array operations as of 8.1, apparently it only supports CAST to a varchar as of 8.3. fix #3000
* - Support has been improved for Postgresql reflection behavior on very oldMike Bayer2014-02-181-3/+5
| | | | | | | | | | | | (pre 8.1) versions of Postgresql, and potentially other PG engines such as Redshift (assuming Redshift reports the version as < 8.1). The query for "indexes" as well as "primary keys" relies upon inspecting a so-called "int2vector" datatype, which refuses to coerce to an array prior to 8.1 causing failures regarding the "ANY()" operator used in the query. Extensive googling has located the very hacky, but recommended-by-PG-core-developer query to use when PG version < 8.1 is in use, so index and primary key constraint reflection now work on these versions.
* - Added :paramref:`.MetaData.reflect.**dialect_kwargs`Mike Bayer2014-02-021-88/+175
| | | | | | | | | | | | | | | | | | to support dialect-level reflection options for all :class:`.Table` objects reflected. - Added a new dialect-level argument ``postgresql_ignore_search_path``; this argument is accepted by both the :class:`.Table` constructor as well as by the :meth:`.MetaData.reflect` method. When in use against Postgresql, a foreign-key referenced table which specifies a remote schema name will retain that schema name even if the name is present in the ``search_path``; the default behavior since 0.7.3 has been that schemas present in ``search_path`` would not be copied to reflected :class:`.ForeignKey` objects. The documentation has been updated to describe in detail the behavior of the ``pg_get_constraintdef()`` function and how the ``postgresql_ignore_search_path`` feature essentially determines if we will honor the schema qualification reported by this function or not. [ticket:2922]
* - move this test to PG test_reflectionMike Bayer2013-10-251-0/+65
| | | | - don't use locals()
* - Removed a 128-character truncation from the reflection of theMike Bayer2013-10-181-0/+11
| | | | | | server default for a column; this code was original from PG system views which truncated the string for readability. [ticket:2844]
* refactor test suites for postgresql, mssql, mysql into packages.Mike Bayer2013-06-281-0/+460