@@ -22,7 +22,13 @@ Unreleased
22
22
- Added support for enabling SSL using SQLAlchemy DB URI with parameter
23
23
``?ssl=true``.
24
24
25
- - Add support for SQLAlchemy 1.4
25
+ - Added support for SQLAlchemy 1.4
26
+
27
+ .. note::
28
+
29
+ For learning about the transition to SQLAlchemy 1.4, we recommend the
30
+ corresponding documentation `What’s New in SQLAlchemy 1.4?`_.
31
+
26
32
27
33
28
34
Breaking changes
@@ -31,31 +37,29 @@ Breaking changes
31
37
Textual column expressions
32
38
''''''''''''''''''''''''''
33
39
34
- On the update to SQLAlchemy 1.4, some test cases had to be adjusted in order
35
- to compensate for apparent additional strictness of SQLAlchemy on some details.
40
+ SQLAlchemy 1.4 became stricter on some details. Where it was ok to use a
41
+ textual column expression in *plain text* beforehand, a
42
+ `SQLAlchemy literal_column`_ type should be used now. This specifically
43
+ applies to `CrateDB system columns`_ like ``_score``.
36
44
37
- Where it was ok to use a textual column expression in plain text beforehand,
38
- a `SQLAlchemy literal_column`_ type should be used now. Otherwise, for example
39
- when accessing `CrateDB system columns`_ like ``_score``, the engine might
40
- complain like::
45
+ For example, when a query might have looked like this beforehand::
41
46
42
- sqlalchemy.exc.ArgumentError: Textual column expression '_score' should be
43
- explicitly declared with text('_score'), or use column('_score') for more
44
- specificity
47
+ session.query(Character.name, '_score')
45
48
46
- The changes to be made look like this ::
49
+ it should now be written like::
47
50
48
- old: session.query(Character.name, '_score')
49
- new: session.query(Character.name, sa.literal_column('_score'))
51
+ session.query(Character.name, sa.literal_column('_score'))
50
52
51
- ::
53
+ Otherwise, SQLAlchemy will complain like ::
52
54
53
- old: .order_by(sa.desc(sa.text('_score')))
54
- new: .order_by(sa.desc(sa.literal_column('_score')))
55
+ sqlalchemy.exc.ArgumentError: Textual column expression '_score' should be
56
+ explicitly declared with text('_score'), or use column('_score') for more
57
+ specificity
55
58
56
59
57
- .. _SQLAlchemy literal_column: https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.literal_column
58
60
.. _CrateDB system columns: https://crate.io/docs/crate/reference/en/4.8/general/ddl/system-columns.html
61
+ .. _SQLAlchemy literal_column: https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.literal_column
62
+ .. _What’s New in SQLAlchemy 1.4?: https://docs.sqlalchemy.org/en/14/changelog/migration_14.html
59
63
60
64
61
65
2020/09/28 0.26.0
0 commit comments