Skip to content

Commit 1d06f07

Browse files
committed
Make foreign key helpers SA 1.0 compliant
1 parent 5145224 commit 1d06f07

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Here you can see the full list of changes between each SQLAlchemy-Utils release.
99

1010
- Drop undocumented batch fetch feature. Let's wait until the inner workings of SQLAlchemy loading API is well-documented.
1111
- Fixed GenericRelationshipProperty comparator to work with SA 1.0.x (#139)
12+
- Make all foreign key helpers SA 1.0 compliant
1213
- Make translation_hybrid expression work the same way as SQLAlchemy-i18n translation expressions
14+
- Update SQLAlchemy dependency to 1.0
1315

1416

1517
0.30.0 (2015-04-15)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def get_version():
8383
],
8484
install_requires=[
8585
'six',
86-
'SQLAlchemy>=0.9.9',
86+
'SQLAlchemy>=1.0',
8787
'total_ordering>=0.1'
8888
if sys.version_info[0] == 2 and sys.version_info[1] < 7 else '',
8989
'ordereddict>=1.1'

sqlalchemy_utils/functions/foreign_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
def get_foreign_key_values(fk, obj):
1515
return dict(
1616
(
17-
fk.constraint.columns[index].key,
17+
fk.constraint.columns.values()[index].key,
1818
getattr(obj, element.column.key)
1919
)
2020
for

tests/functions/test_make_order_by_deterministic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_ascending_order_by(self):
6464
def test_string_order_by(self):
6565
query = self.session.query(self.User).order_by('name')
6666
query = make_order_by_deterministic(query)
67-
assert_contains('ORDER BY name, "user".id ASC', query)
67+
assert_contains('ORDER BY "user".name, "user".id ASC', query)
6868

6969
def test_annotated_label(self):
7070
query = self.session.query(self.User).order_by(self.User.article_count)

tests/functions/test_non_indexed_foreign_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_finds_all_non_indexed_fks(self):
4444
fks
4545
)
4646
column_names = [
47-
column_name for column_name in fks['article'][0].columns
47+
column_name for column_name in fks['article'][0].columns.keys()
4848
]
4949
assert 'category_id' in column_names
5050
assert 'author_id' not in column_names

0 commit comments

Comments
 (0)