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.
Files changed (63) hide show
  1. {crate-0.30.0 → crate-0.30.1}/PKG-INFO +1 -1
  2. {crate-0.30.0 → crate-0.30.1}/src/crate/client/__init__.py +1 -1
  3. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/dialect.py +4 -4
  4. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/dialect_test.py +30 -2
  5. {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/PKG-INFO +1 -1
  6. {crate-0.30.0 → crate-0.30.1}/CONTRIBUTING.rst +0 -0
  7. {crate-0.30.0 → crate-0.30.1}/DEVELOP.rst +0 -0
  8. {crate-0.30.0 → crate-0.30.1}/LICENSE +0 -0
  9. {crate-0.30.0 → crate-0.30.1}/MANIFEST.in +0 -0
  10. {crate-0.30.0 → crate-0.30.1}/NOTICE +0 -0
  11. {crate-0.30.0 → crate-0.30.1}/README.rst +0 -0
  12. {crate-0.30.0 → crate-0.30.1}/docs/_extra/robots.txt +0 -0
  13. {crate-0.30.0 → crate-0.30.1}/docs/requirements.txt +0 -0
  14. {crate-0.30.0 → crate-0.30.1}/pyproject.toml +0 -0
  15. {crate-0.30.0 → crate-0.30.1}/setup.cfg +0 -0
  16. {crate-0.30.0 → crate-0.30.1}/setup.py +0 -0
  17. {crate-0.30.0 → crate-0.30.1}/src/crate/__init__.py +0 -0
  18. {crate-0.30.0 → crate-0.30.1}/src/crate/client/_pep440.py +0 -0
  19. {crate-0.30.0 → crate-0.30.1}/src/crate/client/blob.py +0 -0
  20. {crate-0.30.0 → crate-0.30.1}/src/crate/client/connection.py +0 -0
  21. {crate-0.30.0 → crate-0.30.1}/src/crate/client/converter.py +0 -0
  22. {crate-0.30.0 → crate-0.30.1}/src/crate/client/cursor.py +0 -0
  23. {crate-0.30.0 → crate-0.30.1}/src/crate/client/exceptions.py +0 -0
  24. {crate-0.30.0 → crate-0.30.1}/src/crate/client/http.py +0 -0
  25. {crate-0.30.0 → crate-0.30.1}/src/crate/client/pki/readme.rst +0 -0
  26. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/__init__.py +0 -0
  27. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/__init__.py +0 -0
  28. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/api13.py +0 -0
  29. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/core10.py +0 -0
  30. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/core14.py +0 -0
  31. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compat/core20.py +0 -0
  32. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/compiler.py +0 -0
  33. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/predicates/__init__.py +0 -0
  34. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/sa_version.py +0 -0
  35. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/__init__.py +0 -0
  36. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/array_test.py +0 -0
  37. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/bulk_test.py +0 -0
  38. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/compiler_test.py +0 -0
  39. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/connection_test.py +0 -0
  40. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/create_table_test.py +0 -0
  41. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/datetime_test.py +0 -0
  42. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/dict_test.py +0 -0
  43. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/function_test.py +0 -0
  44. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/insert_from_select_test.py +0 -0
  45. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/match_test.py +0 -0
  46. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/update_test.py +0 -0
  47. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/tests/warnings_test.py +0 -0
  48. {crate-0.30.0 → crate-0.30.1}/src/crate/client/sqlalchemy/types.py +0 -0
  49. {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_connection.py +0 -0
  50. {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_cursor.py +0 -0
  51. {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_http.py +0 -0
  52. {crate-0.30.0 → crate-0.30.1}/src/crate/client/test_util.py +0 -0
  53. {crate-0.30.0 → crate-0.30.1}/src/crate/testing/__init__.py +0 -0
  54. {crate-0.30.0 → crate-0.30.1}/src/crate/testing/layer.py +0 -0
  55. {crate-0.30.0 → crate-0.30.1}/src/crate/testing/settings.py +0 -0
  56. {crate-0.30.0 → crate-0.30.1}/src/crate/testing/test_layer.py +0 -0
  57. {crate-0.30.0 → crate-0.30.1}/src/crate/testing/util.py +0 -0
  58. {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/SOURCES.txt +0 -0
  59. {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/dependency_links.txt +0 -0
  60. {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/entry_points.txt +0 -0
  61. {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/namespace_packages.txt +0 -0
  62. {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/requires.txt +0 -0
  63. {crate-0.30.0 → crate-0.30.1}/src/crate.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crate
3
- Version: 0.30.0
3
+ Version: 0.30.1
4
4
  Summary: CrateDB Python Client
5
5
  Home-page: https://github.com/crate/crate-python
6
6
  Author: Crate.io
@@ -29,7 +29,7 @@ __all__ = [
29
29
 
30
30
  # version string read from setup.py using a regex. Take care not to break the
31
31
  # regex!
32
- __version__ = "0.30.0"
32
+ __version__ = "0.30.1"
33
33
 
34
34
  apilevel = "2.0"
35
35
  threadsafety = 2
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: crate
3
- Version: 0.30.0
3
+ Version: 0.30.1
4
4
  Summary: CrateDB Python Client
5
5
  Home-page: https://github.com/crate/crate-python
6
6
  Author: Crate.io
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