Skip to content

Commit 9802da8

Browse files
committed
Drop support for CrateDB < 2.0.0
1 parent 66bbd28 commit 9802da8

File tree

5 files changed

+7
-17
lines changed

5 files changed

+7
-17
lines changed

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Unreleased
88
- Added official support for Python 3.9 and 3.10.
99
- Dropped support for SQLAlchemy 1.1 and 1.2.
1010

11-
- Dropped support for CrateDB < 1.0.0.
11+
- Dropped support for CrateDB < 2.0.0.
1212

1313

1414
- BREAKING CHANGE: The driver now verifies SSL certificates when connecting via

src/crate/client/doctests/connection.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We create a new connection object::
1010

1111
>>> connection = connect(client=connection_client_mocked)
1212
>>> connection.lowest_server_version.version
13-
(1, 42, 0)
13+
(2, 0, 0)
1414

1515
Calling the ``cursor()`` function on the connection will
1616
return a cursor object::

src/crate/client/sqlalchemy/dialect.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
from crate.client.exceptions import TimezoneUnawareException
3636
from .types import Object, ObjectArray
3737

38-
TABLE_TYPE_MIN_VERSION = (2, 0, 0)
39-
4038
TYPES_MAP = {
4139
"boolean": sqltypes.Boolean,
4240
"short": sqltypes.SmallInteger,
@@ -230,13 +228,11 @@ def get_schema_names(self, connection, **kw):
230228

231229
@reflection.cache
232230
def get_table_names(self, connection, schema=None, **kw):
233-
table_filter = "AND table_type = 'BASE TABLE' " \
234-
if self.server_version_info >= TABLE_TYPE_MIN_VERSION else ""
235231
cursor = connection.execute(
236232
"SELECT table_name FROM information_schema.tables "
237-
"WHERE {0} = ? {1}"
238-
"ORDER BY table_name ASC, {0} ASC".format(self.schema_column,
239-
table_filter),
233+
"WHERE {0} = ? "
234+
"AND table_type = 'BASE TABLE' "
235+
"ORDER BY table_name ASC, {0} ASC".format(self.schema_column),
240236
[schema or self.default_schema_name]
241237
)
242238
return [row[0] for row in cursor.fetchall()]

src/crate/client/sqlalchemy/tests/dialect_test.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,4 @@ def test_get_table_names(self):
9494
self.engine.dialect.server_version_info = (2, 0, 0)
9595
eq_(insp.get_table_names(self.connection, "doc"),
9696
['t1', 't2'])
97-
in_("AND table_type = 'BASE TABLE' ORDER BY", self.executed_statement)
98-
99-
insp = inspect(self.character.metadata.bind)
100-
self.engine.dialect.server_version_info = (1, 0, 0)
101-
eq_(insp.get_table_names(self.connection, "doc"),
102-
['t1', 't2'])
103-
in_("WHERE table_schema = ? ORDER BY", self.executed_statement)
97+
in_("WHERE table_schema = ? AND table_type = 'BASE TABLE' ORDER BY", self.executed_statement)

src/crate/client/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class ClientMocked(object):
7575

7676
def __init__(self):
7777
self.response = {}
78-
self._server_infos = ("http://localhost:4200", "my server", "1.42.0")
78+
self._server_infos = ("http://localhost:4200", "my server", "2.0.0")
7979

8080
def sql(self, stmt=None, parameters=None, bulk_parameters=None):
8181
return self.response

0 commit comments

Comments
 (0)