crate 0.30.0__tar.gz → 0.30.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {crate-0.30.0 → crate-0.30.1}/PKG-INFO +1 -1
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/__init__.py +1 -1
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/dialect.py +4 -4
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/dialect_test.py +30 -2
- {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/PKG-INFO +1 -1
- {crate-0.30.0 → crate-0.30.1}/CONTRIBUTING.rst +0 -0
- {crate-0.30.0 → crate-0.30.1}/DEVELOP.rst +0 -0
- {crate-0.30.0 → crate-0.30.1}/LICENSE +0 -0
- {crate-0.30.0 → crate-0.30.1}/MANIFEST.in +0 -0
- {crate-0.30.0 → crate-0.30.1}/NOTICE +0 -0
- {crate-0.30.0 → crate-0.30.1}/README.rst +0 -0
- {crate-0.30.0 → crate-0.30.1}/docs/_extra/robots.txt +0 -0
- {crate-0.30.0 → crate-0.30.1}/docs/requirements.txt +0 -0
- {crate-0.30.0 → crate-0.30.1}/pyproject.toml +0 -0
- {crate-0.30.0 → crate-0.30.1}/setup.cfg +0 -0
- {crate-0.30.0 → crate-0.30.1}/setup.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/__init__.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/_pep440.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/blob.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/connection.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/converter.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/cursor.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/exceptions.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/http.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/pki/readme.rst +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/__init__.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/__init__.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/api13.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/core10.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/core14.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/core20.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compiler.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/predicates/__init__.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/sa_version.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/__init__.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/array_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/bulk_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/compiler_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/connection_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/create_table_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/datetime_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/dict_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/function_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/insert_from_select_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/match_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/update_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/warnings_test.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/types.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_connection.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_cursor.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_http.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_util.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/testing/__init__.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/testing/layer.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/testing/settings.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/testing/test_layer.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate/testing/util.py +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/SOURCES.txt +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/dependency_links.txt +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/entry_points.txt +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/namespace_packages.txt +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/requires.txt +0 -0
- {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/top_level.txt +0 -0
@@ -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")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|