Skip to content

Commit 62d11e4

Browse files
author
Jesse
authored
SQLAlchemy 2: Finish marking all tests in the suite (#253)
Signed-off-by: Jesse Whitehouse <[email protected]>
1 parent 873c570 commit 62d11e4

File tree

4 files changed

+490
-51
lines changed

4 files changed

+490
-51
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from databricks.sqlalchemy.base import DatabricksDialect
1+
from databricks.sqlalchemy.base import DatabricksDialect

src/databricks/sqlalchemy/base.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class DatabricksImpl(DefaultImpl):
4545
class DatabricksDialect(default.DefaultDialect):
4646
"""This dialect implements only those methods required to pass our e2e tests"""
4747

48-
# Possible attributes are defined here: https://docs.sqlalchemy.org/en/14/core/internals.html#sqlalchemy.engine.Dialect
48+
# See sqlalchemy.engine.interfaces for descriptions of each of these properties
4949
name: str = "databricks"
5050
driver: str = "databricks"
5151
default_schema_name: str = "default"
@@ -60,6 +60,10 @@ class DatabricksDialect(default.DefaultDialect):
6060
supports_identity_columns: bool = True
6161
supports_schemas: bool = True
6262
paramstyle: str = "named"
63+
div_is_floordiv: bool = False
64+
supports_default_values: bool = False
65+
supports_server_side_cursors: bool = False
66+
supports_sequences: bool = False
6367

6468
colspecs = {
6569
sqlalchemy.types.DateTime: dialect_type_impl.DatabricksDateTimeNoTimezoneType,
@@ -109,7 +113,18 @@ def get_columns(
109113
).fetchall()
110114

111115
if not resp:
112-
raise sqlalchemy.exc.NoSuchTableError(table_name)
116+
# TGetColumnsRequest will not raise an exception if passed a table that doesn't exist
117+
# But Databricks supports tables with no columns. So if the result is an empty list,
118+
# we need to check if the table exists (and raise an exception if not) or simply return
119+
# an empty list.
120+
self._describe_table_extended(
121+
connection,
122+
table_name,
123+
self.catalog,
124+
schema or self.schema,
125+
expect_result=False,
126+
)
127+
return resp
113128
columns = []
114129
for col in resp:
115130
row_dict = parse_column_info_from_tgetcolumnsresponse(col)

src/databricks/sqlalchemy/requirements.py

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def temporary_tables(self):
158158
def table_reflection(self):
159159
"""target database has general support for table reflection"""
160160
return sqlalchemy.testing.exclusions.open()
161-
161+
162162
@property
163163
def temp_table_reflection(self):
164164
"""ComponentReflection test is intricate and simply cannot function without this exclusion being defined here.
@@ -181,9 +181,50 @@ def unique_constraint_reflection(self):
181181
Databricks doesn't support UNIQUE constraints.
182182
"""
183183
return sqlalchemy.testing.exclusions.closed()
184-
184+
185185
@property
186186
def reflects_pk_names(self):
187187
"""Target driver reflects the name of primary key constraints."""
188188

189-
return sqlalchemy.testing.exclusions.open()
189+
return sqlalchemy.testing.exclusions.open()
190+
191+
@property
192+
def datetime_implicit_bound(self):
193+
"""target dialect when given a datetime object will bind it such
194+
that the database server knows the object is a date, and not
195+
a plain string.
196+
"""
197+
198+
return sqlalchemy.testing.exclusions.open()
199+
200+
@property
201+
def tuple_in(self):
202+
return sqlalchemy.testing.exclusions.open()
203+
204+
@property
205+
def ctes(self):
206+
return sqlalchemy.testing.exclusions.open()
207+
208+
@property
209+
def ctes_with_update_delete(self):
210+
return sqlalchemy.testing.exclusions.open()
211+
212+
@property
213+
def delete_from(self):
214+
"""Target must support DELETE FROM..FROM or DELETE..USING syntax"""
215+
return sqlalchemy.testing.exclusions.open()
216+
217+
@property
218+
def table_value_constructor(self):
219+
return sqlalchemy.testing.exclusions.open()
220+
221+
@property
222+
def reflect_tables_no_columns(self):
223+
return sqlalchemy.testing.exclusions.open()
224+
225+
@property
226+
def denormalized_names(self):
227+
"""Target database must have 'denormalized', i.e.
228+
UPPERCASE as case insensitive names."""
229+
230+
return sqlalchemy.testing.exclusions.open()

0 commit comments

Comments
 (0)