crate 0.30.0__py2.py3-none-any.whl → 0.30.1__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crate/client/__init__.py +1 -1
- crate/client/sqlalchemy/dialect.py +4 -4
- crate/client/sqlalchemy/tests/dialect_test.py +30 -2
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/METADATA +1 -1
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/RECORD +12 -12
- /crate-0.30.0-py3.9-nspkg.pth → /crate-0.30.1-py3.9-nspkg.pth +0 -0
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/LICENSE +0 -0
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/NOTICE +0 -0
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/WHEEL +0 -0
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/entry_points.txt +0 -0
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/namespace_packages.txt +0 -0
- {crate-0.30.0.dist-info → crate-0.30.1.dist-info}/top_level.txt +0 -0
crate/client/__init__.py
CHANGED
@@ -227,11 +227,11 @@ class CrateDialect(default.DefaultDialect):
|
|
227
227
|
def dbapi(cls):
|
228
228
|
return cls.import_dbapi()
|
229
229
|
|
230
|
-
def has_schema(self, connection, schema):
|
231
|
-
return schema in self.get_schema_names(connection)
|
230
|
+
def has_schema(self, connection, schema, **kw):
|
231
|
+
return schema in self.get_schema_names(connection, **kw)
|
232
232
|
|
233
|
-
def has_table(self, connection, table_name, schema=None):
|
234
|
-
return table_name in self.get_table_names(connection, schema=schema)
|
233
|
+
def has_table(self, connection, table_name, schema=None, **kw):
|
234
|
+
return table_name in self.get_table_names(connection, schema=schema, **kw)
|
235
235
|
|
236
236
|
@reflection.cache
|
237
237
|
def get_schema_names(self, connection, **kw):
|
@@ -20,12 +20,14 @@
|
|
20
20
|
# software solely pursuant to the terms of the relevant commercial agreement.
|
21
21
|
|
22
22
|
from datetime import datetime
|
23
|
-
from unittest import TestCase
|
23
|
+
from unittest import TestCase, skipIf
|
24
24
|
from unittest.mock import MagicMock, patch
|
25
25
|
|
26
26
|
import sqlalchemy as sa
|
27
27
|
|
28
28
|
from crate.client.cursor import Cursor
|
29
|
+
from crate.client.sqlalchemy import SA_VERSION
|
30
|
+
from crate.client.sqlalchemy.sa_version import SA_1_4, SA_2_0
|
29
31
|
from crate.client.sqlalchemy.types import Object
|
30
32
|
from sqlalchemy import inspect
|
31
33
|
from sqlalchemy.orm import Session
|
@@ -33,7 +35,7 @@ try:
|
|
33
35
|
from sqlalchemy.orm import declarative_base
|
34
36
|
except ImportError:
|
35
37
|
from sqlalchemy.ext.declarative import declarative_base
|
36
|
-
from sqlalchemy.testing import eq_, in_
|
38
|
+
from sqlalchemy.testing import eq_, in_, is_true
|
37
39
|
|
38
40
|
FakeCursor = MagicMock(name='FakeCursor', spec=Cursor)
|
39
41
|
|
@@ -70,6 +72,13 @@ class SqlAlchemyDialectTest(TestCase):
|
|
70
72
|
|
71
73
|
self.session = Session(bind=self.engine)
|
72
74
|
|
75
|
+
def init_mock(self, return_value=None):
|
76
|
+
self.fake_cursor.rowcount = 1
|
77
|
+
self.fake_cursor.description = (
|
78
|
+
('foo', None, None, None, None, None, None),
|
79
|
+
)
|
80
|
+
self.fake_cursor.fetchall = MagicMock(return_value=return_value)
|
81
|
+
|
73
82
|
def test_primary_keys_2_3_0(self):
|
74
83
|
insp = inspect(self.session.bind)
|
75
84
|
self.engine.dialect.server_version_info = (2, 3, 0)
|
@@ -126,3 +135,22 @@ class SqlAlchemyDialectTest(TestCase):
|
|
126
135
|
['v1', 'v2'])
|
127
136
|
eq_(self.executed_statement, "SELECT table_name FROM information_schema.views "
|
128
137
|
"ORDER BY table_name ASC, table_schema ASC")
|
138
|
+
|
139
|
+
@skipIf(SA_VERSION < SA_1_4, "Inspector.has_table only available on SQLAlchemy>=1.4")
|
140
|
+
def test_has_table(self):
|
141
|
+
self.init_mock(return_value=[["foo"], ["bar"]])
|
142
|
+
insp = inspect(self.session.bind)
|
143
|
+
is_true(insp.has_table("bar"))
|
144
|
+
eq_(self.executed_statement,
|
145
|
+
"SELECT table_name FROM information_schema.tables "
|
146
|
+
"WHERE table_schema = ? AND table_type = 'BASE TABLE' "
|
147
|
+
"ORDER BY table_name ASC, table_schema ASC")
|
148
|
+
|
149
|
+
@skipIf(SA_VERSION < SA_2_0, "Inspector.has_schema only available on SQLAlchemy>=2.0")
|
150
|
+
def test_has_schema(self):
|
151
|
+
self.init_mock(
|
152
|
+
return_value=[["blob"], ["doc"], ["information_schema"], ["pg_catalog"], ["sys"]])
|
153
|
+
insp = inspect(self.session.bind)
|
154
|
+
is_true(insp.has_schema("doc"))
|
155
|
+
eq_(self.executed_statement,
|
156
|
+
"select schema_name from information_schema.schemata order by schema_name asc")
|
@@ -1,5 +1,5 @@
|
|
1
|
-
crate-0.30.
|
2
|
-
crate/client/__init__.py,sha256=
|
1
|
+
crate-0.30.1-py3.9-nspkg.pth,sha256=nqN0-lx5dVfXKgm9N7WRgI0lrvtTYi2PUOtTjfAMtjY,534
|
2
|
+
crate/client/__init__.py,sha256=aMAGsfGO3MHvq3jgbmIS_lW8HceoBkyDx2-yuzPwsiQ,1305
|
3
3
|
crate/client/_pep440.py,sha256=5KfZQ9kC9qfVK2YhRaMCuTETTbu-d3bMUOuC4RgHM38,14585
|
4
4
|
crate/client/blob.py,sha256=plTwGEULg5s1VdKIMW6a0Zljdkng7xw0WXkXyiwNaSU,3496
|
5
5
|
crate/client/connection.py,sha256=evWWrPFzI0lg2gPVz3Oy8PIo5AwfR-NhCSHowlpnYlw,8297
|
@@ -14,7 +14,7 @@ crate/client/test_util.py,sha256=xR9bdoHZplNBqIPnXSkHPNIo6bzUeKLnyqxcCmy-4Jw,163
|
|
14
14
|
crate/client/tests.py,sha256=UBRgBRskvPNHfiyXF1PywVkjfZUdtFzW2Wm-nx-RrPE,12986
|
15
15
|
crate/client/sqlalchemy/__init__.py,sha256=RKwu3filTgFGaw-X200qaQa89gRutnFaG-vlxjA6elU,1965
|
16
16
|
crate/client/sqlalchemy/compiler.py,sha256=DL6exuoe-liZR4BqbAyYfi2PzlXnl3ccf1gfFJEh8Rc,7837
|
17
|
-
crate/client/sqlalchemy/dialect.py,sha256=
|
17
|
+
crate/client/sqlalchemy/dialect.py,sha256=Kz83VQNJNYdqxlLL4Sg4H0n7jN_Kg17-L-fSxb3SMgA,12940
|
18
18
|
crate/client/sqlalchemy/sa_version.py,sha256=exLPKCalcinLZ9geiqPX_pFWOoxnDkkxTy5AOabf9zw,1181
|
19
19
|
crate/client/sqlalchemy/types.py,sha256=8aXPln79WQ5QNqDJZL2TSvG31XO0pWo9EqF2XOzzgYU,8257
|
20
20
|
crate/client/sqlalchemy/compat/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -30,7 +30,7 @@ crate/client/sqlalchemy/tests/compiler_test.py,sha256=M62a0h23jDjfO5Ohkw4pv_8eah
|
|
30
30
|
crate/client/sqlalchemy/tests/connection_test.py,sha256=LW2hIlEbhQWopZZ-Zp1nejRxEfMmaGwFbxwfQFQ8sBk,4596
|
31
31
|
crate/client/sqlalchemy/tests/create_table_test.py,sha256=nvVphw-shsf8JMUopQk66-jJN89AVxYSIiAPV43KmtI,9176
|
32
32
|
crate/client/sqlalchemy/tests/datetime_test.py,sha256=E84Xd-g7kIshKdGQ6J2RMvuao-Od0iCpz11JLfyA5s8,3170
|
33
|
-
crate/client/sqlalchemy/tests/dialect_test.py,sha256=
|
33
|
+
crate/client/sqlalchemy/tests/dialect_test.py,sha256=ugTljMQZ5Qkloxop3G5ptkCuBLSR_2h_2UZaiX8Dl2c,6275
|
34
34
|
crate/client/sqlalchemy/tests/dict_test.py,sha256=SJPBUs3-MPZ3XxYPF1KGz7bxbWKCArZz0dvtqhysuWk,16600
|
35
35
|
crate/client/sqlalchemy/tests/function_test.py,sha256=XQrPW8WKPI_aLgZo9kpfO2Wjx6dWp3ureqtgkghl2xk,1824
|
36
36
|
crate/client/sqlalchemy/tests/insert_from_select_test.py,sha256=UeSk-34qh_mrZNr4q1uriFI9UxPieFPJ2eKjNhHkEPc,3256
|
@@ -43,11 +43,11 @@ crate/testing/settings.py,sha256=YTqod79NO4Lv_agPgMLGlB_fMe6baAhLXFKBZnuytBk,165
|
|
43
43
|
crate/testing/test_layer.py,sha256=9x3FiyJcsB9oSY5vVzMaL_DvwJt91a_hquXS7gbDYdQ,11525
|
44
44
|
crate/testing/tests.py,sha256=seACn7a4HbQIGxJmKXiUDkuE9ossO7UsSMTwMYimOA0,1287
|
45
45
|
crate/testing/util.py,sha256=qtc72rKfvfTA9VMKjE2JSukffobd7ffCcddoTiAdO6A,690
|
46
|
-
crate-0.30.
|
47
|
-
crate-0.30.
|
48
|
-
crate-0.30.
|
49
|
-
crate-0.30.
|
50
|
-
crate-0.30.
|
51
|
-
crate-0.30.
|
52
|
-
crate-0.30.
|
53
|
-
crate-0.30.
|
46
|
+
crate-0.30.1.dist-info/LICENSE,sha256=1QGh4tR_JmDKn33ztoDv2UkER0Q4Zh1kC5J3vMWwRso,12854
|
47
|
+
crate-0.30.1.dist-info/METADATA,sha256=_BAElXFOJzZY9u7hMcU-PEHoUCxuocEDwTjYAYw2XIU,4526
|
48
|
+
crate-0.30.1.dist-info/NOTICE,sha256=vwbBS8sykCOndA1kjuu8dUInljH27kk3lcPBzQ2SMns,1159
|
49
|
+
crate-0.30.1.dist-info/WHEEL,sha256=bb2Ot9scclHKMOLDEHY6B2sicWOgugjFKaJsT7vwMQo,110
|
50
|
+
crate-0.30.1.dist-info/entry_points.txt,sha256=DN4zBP45-6hmDwuOAR9LFoxzrg-A9MqPh1Hn6UXEFPQ,68
|
51
|
+
crate-0.30.1.dist-info/namespace_packages.txt,sha256=2wP2HlpxdhgTLMl9ipi168xkm6FMq9_2bf0xGGxF_OI,6
|
52
|
+
crate-0.30.1.dist-info/top_level.txt,sha256=2wP2HlpxdhgTLMl9ipi168xkm6FMq9_2bf0xGGxF_OI,6
|
53
|
+
crate-0.30.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|