diff --git a/docs/by-example/sqlalchemy/advanced-querying.rst b/docs/by-example/sqlalchemy/advanced-querying.rst index e8bc1bab..14eae020 100644 --- a/docs/by-example/sqlalchemy/advanced-querying.rst +++ b/docs/by-example/sqlalchemy/advanced-querying.rst @@ -21,7 +21,11 @@ Introduction Import the relevant symbols: >>> import sqlalchemy as sa - >>> from sqlalchemy.orm import declarative_base, sessionmaker + >>> from sqlalchemy.orm import sessionmaker + >>> try: + ... from sqlalchemy.orm import declarative_base + ... except ImportError: + ... from sqlalchemy.ext.declarative import declarative_base >>> from uuid import uuid4 Establish a connection to the database, see also :ref:`sa:engines_toplevel` diff --git a/docs/by-example/sqlalchemy/crud.rst b/docs/by-example/sqlalchemy/crud.rst index 3a1e0f21..f3bb4871 100644 --- a/docs/by-example/sqlalchemy/crud.rst +++ b/docs/by-example/sqlalchemy/crud.rst @@ -27,7 +27,11 @@ Import the relevant symbols: >>> import sqlalchemy as sa >>> from datetime import datetime >>> from sqlalchemy import delete, func, text - >>> from sqlalchemy.orm import declarative_base, sessionmaker + >>> from sqlalchemy.orm import sessionmaker + >>> try: + ... from sqlalchemy.orm import declarative_base + ... except ImportError: + ... from sqlalchemy.ext.declarative import declarative_base >>> from crate.client.sqlalchemy.types import ObjectArray Establish a connection to the database: diff --git a/docs/by-example/sqlalchemy/getting-started.rst b/docs/by-example/sqlalchemy/getting-started.rst index 0f3bd26a..c64964dc 100644 --- a/docs/by-example/sqlalchemy/getting-started.rst +++ b/docs/by-example/sqlalchemy/getting-started.rst @@ -28,7 +28,11 @@ Introduction Import the relevant symbols: >>> import sqlalchemy as sa - >>> from sqlalchemy.orm import declarative_base, sessionmaker + >>> from sqlalchemy.orm import sessionmaker + >>> try: + ... from sqlalchemy.orm import declarative_base + ... except ImportError: + ... from sqlalchemy.ext.declarative import declarative_base Establish a connection to the database, see also :ref:`sa:engines_toplevel` and :ref:`connect`: diff --git a/docs/by-example/sqlalchemy/working-with-types.rst b/docs/by-example/sqlalchemy/working-with-types.rst index e22d5305..22c69010 100644 --- a/docs/by-example/sqlalchemy/working-with-types.rst +++ b/docs/by-example/sqlalchemy/working-with-types.rst @@ -26,8 +26,12 @@ Import the relevant symbols: >>> from datetime import datetime >>> from geojson import Point, Polygon >>> from sqlalchemy import delete, func, text - >>> from sqlalchemy.orm import declarative_base, sessionmaker + >>> from sqlalchemy.orm import sessionmaker >>> from sqlalchemy.sql import operators + >>> try: + ... from sqlalchemy.orm import declarative_base + ... except ImportError: + ... from sqlalchemy.ext.declarative import declarative_base >>> from uuid import uuid4 >>> from crate.client.sqlalchemy.types import Object, ObjectArray >>> from crate.client.sqlalchemy.types import Geopoint, Geoshape diff --git a/src/crate/client/sqlalchemy/tests/array_test.py b/src/crate/client/sqlalchemy/tests/array_test.py index d3a19fcb..6d663327 100644 --- a/src/crate/client/sqlalchemy/tests/array_test.py +++ b/src/crate/client/sqlalchemy/tests/array_test.py @@ -25,7 +25,11 @@ import sqlalchemy as sa from sqlalchemy.sql import operators -from sqlalchemy.orm import declarative_base, Session +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.cursor import Cursor diff --git a/src/crate/client/sqlalchemy/tests/bulk_test.py b/src/crate/client/sqlalchemy/tests/bulk_test.py index ab10f3be..95bc1ddd 100644 --- a/src/crate/client/sqlalchemy/tests/bulk_test.py +++ b/src/crate/client/sqlalchemy/tests/bulk_test.py @@ -23,7 +23,11 @@ from unittest.mock import patch, MagicMock import sqlalchemy as sa -from sqlalchemy.orm import declarative_base, Session +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.cursor import Cursor diff --git a/src/crate/client/sqlalchemy/tests/create_table_test.py b/src/crate/client/sqlalchemy/tests/create_table_test.py index 09deeccb..7eca2628 100644 --- a/src/crate/client/sqlalchemy/tests/create_table_test.py +++ b/src/crate/client/sqlalchemy/tests/create_table_test.py @@ -20,7 +20,10 @@ # software solely pursuant to the terms of the relevant commercial agreement. import sqlalchemy as sa -from sqlalchemy.orm import declarative_base +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.sqlalchemy.types import Object, ObjectArray, Geopoint from crate.client.cursor import Cursor diff --git a/src/crate/client/sqlalchemy/tests/datetime_test.py b/src/crate/client/sqlalchemy/tests/datetime_test.py index 1f4d0c72..07e98ede 100644 --- a/src/crate/client/sqlalchemy/tests/datetime_test.py +++ b/src/crate/client/sqlalchemy/tests/datetime_test.py @@ -26,7 +26,11 @@ import sqlalchemy as sa from sqlalchemy.exc import DBAPIError -from sqlalchemy.orm import declarative_base, Session +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.cursor import Cursor diff --git a/src/crate/client/sqlalchemy/tests/dialect_test.py b/src/crate/client/sqlalchemy/tests/dialect_test.py index 5c04f1ac..a6669df4 100644 --- a/src/crate/client/sqlalchemy/tests/dialect_test.py +++ b/src/crate/client/sqlalchemy/tests/dialect_test.py @@ -28,7 +28,11 @@ from crate.client.cursor import Cursor from crate.client.sqlalchemy.types import Object from sqlalchemy import inspect -from sqlalchemy.orm import declarative_base, Session +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.testing import eq_, in_ FakeCursor = MagicMock(name='FakeCursor', spec=Cursor) diff --git a/src/crate/client/sqlalchemy/tests/dict_test.py b/src/crate/client/sqlalchemy/tests/dict_test.py index dbec0eef..2324591e 100644 --- a/src/crate/client/sqlalchemy/tests/dict_test.py +++ b/src/crate/client/sqlalchemy/tests/dict_test.py @@ -25,7 +25,11 @@ import sqlalchemy as sa from sqlalchemy.sql import select -from sqlalchemy.orm import declarative_base, Session +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.sqlalchemy.types import Craty, ObjectArray from crate.client.cursor import Cursor diff --git a/src/crate/client/sqlalchemy/tests/function_test.py b/src/crate/client/sqlalchemy/tests/function_test.py index 95613955..072ab43a 100644 --- a/src/crate/client/sqlalchemy/tests/function_test.py +++ b/src/crate/client/sqlalchemy/tests/function_test.py @@ -22,8 +22,11 @@ from unittest import TestCase import sqlalchemy as sa -from sqlalchemy.orm import declarative_base from sqlalchemy.sql.sqltypes import TIMESTAMP +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base class SqlAlchemyFunctionTest(TestCase): diff --git a/src/crate/client/sqlalchemy/tests/insert_from_select_test.py b/src/crate/client/sqlalchemy/tests/insert_from_select_test.py index b4be7005..692dfa55 100644 --- a/src/crate/client/sqlalchemy/tests/insert_from_select_test.py +++ b/src/crate/client/sqlalchemy/tests/insert_from_select_test.py @@ -24,8 +24,12 @@ from unittest.mock import patch, MagicMock import sqlalchemy as sa -from sqlalchemy.orm import declarative_base, Session from sqlalchemy import select, insert +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.cursor import Cursor diff --git a/src/crate/client/sqlalchemy/tests/match_test.py b/src/crate/client/sqlalchemy/tests/match_test.py index 021ec584..fdd5b7d0 100644 --- a/src/crate/client/sqlalchemy/tests/match_test.py +++ b/src/crate/client/sqlalchemy/tests/match_test.py @@ -24,7 +24,11 @@ from unittest.mock import MagicMock import sqlalchemy as sa -from sqlalchemy.orm import declarative_base, Session +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.sqlalchemy.types import Craty from crate.client.sqlalchemy.predicates import match diff --git a/src/crate/client/sqlalchemy/tests/update_test.py b/src/crate/client/sqlalchemy/tests/update_test.py index 0a29d85e..00aeef0a 100644 --- a/src/crate/client/sqlalchemy/tests/update_test.py +++ b/src/crate/client/sqlalchemy/tests/update_test.py @@ -26,7 +26,11 @@ from crate.client.sqlalchemy.types import Object import sqlalchemy as sa -from sqlalchemy.orm import declarative_base, Session +from sqlalchemy.orm import Session +try: + from sqlalchemy.orm import declarative_base +except ImportError: + from sqlalchemy.ext.declarative import declarative_base from crate.client.cursor import Cursor