Make foreign key helpers SA 1.0 compliant

This commit is contained in:
Konsta Vesterinen
2015-05-05 14:13:12 +03:00
parent 5145224476
commit 1d06f07077
5 changed files with 6 additions and 4 deletions

View File

@@ -9,7 +9,9 @@ Here you can see the full list of changes between each SQLAlchemy-Utils release.
- Drop undocumented batch fetch feature. Let's wait until the inner workings of SQLAlchemy loading API is well-documented.
- Fixed GenericRelationshipProperty comparator to work with SA 1.0.x (#139)
- Make all foreign key helpers SA 1.0 compliant
- Make translation_hybrid expression work the same way as SQLAlchemy-i18n translation expressions
- Update SQLAlchemy dependency to 1.0
0.30.0 (2015-04-15)

View File

@@ -83,7 +83,7 @@ setup(
],
install_requires=[
'six',
'SQLAlchemy>=0.9.9',
'SQLAlchemy>=1.0',
'total_ordering>=0.1'
if sys.version_info[0] == 2 and sys.version_info[1] < 7 else '',
'ordereddict>=1.1'

View File

@@ -14,7 +14,7 @@ from .orm import get_column_key, get_mapper, get_tables
def get_foreign_key_values(fk, obj):
return dict(
(
fk.constraint.columns[index].key,
fk.constraint.columns.values()[index].key,
getattr(obj, element.column.key)
)
for

View File

@@ -64,7 +64,7 @@ class TestMakeOrderByDeterministic(TestCase):
def test_string_order_by(self):
query = self.session.query(self.User).order_by('name')
query = make_order_by_deterministic(query)
assert_contains('ORDER BY name, "user".id ASC', query)
assert_contains('ORDER BY "user".name, "user".id ASC', query)
def test_annotated_label(self):
query = self.session.query(self.User).order_by(self.User.article_count)

View File

@@ -44,7 +44,7 @@ class TestFindNonIndexedForeignKeys(TestCase):
fks
)
column_names = [
column_name for column_name in fks['article'][0].columns
column_name for column_name in fks['article'][0].columns.keys()
]
assert 'category_id' in column_names
assert 'author_id' not in column_names