diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-06-19 14:10:47 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2015-06-19 14:10:47 -0400 |
commit | e625d2ea88f4ae3e0a667b3d2a904dafbd0421b9 (patch) | |
tree | 20d026818f04242d86e60f11d262f6016048ad0e /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | 99ceed3e55e87c7aca9898359e68c90ecee7965c (diff) | |
download | sqlalchemy-e625d2ea88f4ae3e0a667b3d2a904dafbd0421b9.tar.gz |
- for #3455
- 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
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index b46c65335..22c66dbbb 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -401,6 +401,8 @@ The value passed to the keyword argument will be simply passed through to the underlying CREATE INDEX command, so it *must* be a valid index type for your version of PostgreSQL. +.. _postgresql_index_storage: + Index Storage Parameters ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -411,6 +413,8 @@ keyword argument:: Index('my_index', my_table.c.data, postgresql_with={"fillfactor": 50}) +.. versionadded:: 1.0.6 + .. _postgresql_index_concurrently: Indexes with CONCURRENTLY @@ -2690,7 +2694,8 @@ class PGDialect(default.DefaultDialect): sv_idx_name = None for row in c.fetchall(): - idx_name, unique, expr, prd, col, col_num, conrelid, idx_key, options, amname = row + (idx_name, unique, expr, prd, col, + col_num, conrelid, idx_key, options, amname) = row if expr: if idx_name != sv_idx_name: @@ -2717,7 +2722,13 @@ class PGDialect(default.DefaultDialect): if conrelid is not None: index['duplicates_constraint'] = idx_name if options: - index['options'] = dict([option.split("=") for option in options]) + index['options'] = dict( + [option.split("=") for option in options]) + + # it *might* be nice to include that this is 'btree' in the + # reflection info. But we don't want an Index object + # to have a ``postgresql_using`` in it that is just the + # default, so for the moment leaving this out. if amname and amname != 'btree': index['amname'] = amname @@ -2731,9 +2742,11 @@ class PGDialect(default.DefaultDialect): if 'duplicates_constraint' in idx: entry['duplicates_constraint'] = idx['duplicates_constraint'] if 'options' in idx: - entry.setdefault('dialect_options', {})["postgresql_with"] = idx['options'] + entry.setdefault( + 'dialect_options', {})["postgresql_with"] = idx['options'] if 'amname' in idx: - entry.setdefault('dialect_options', {})["postgresql_using"] = idx['amname'] + entry.setdefault( + 'dialect_options', {})["postgresql_using"] = idx['amname'] result.append(entry) return result |