Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
988becd
Skip IdentityReflectionTest as it doesn't seem possible at this time
Oct 16, 2023
fad7325
Make TrueDivTest pass
Oct 16, 2023
b64d2f7
Remove duplicate test skip directive
Oct 16, 2023
814093d
Add skip markers for InsertBehaviorTest
Oct 16, 2023
67fb1de
Explicitly mark these test cases as reviewed
Oct 16, 2023
472bcb2
Call out tests for types we can't bind
Oct 16, 2023
07c73a6
Skip JSONTest. Will use PM input to guide when we implement this
Oct 16, 2023
df710cf
Add more skip markers for unsupported features
Oct 16, 2023
e6a75c7
Add support for ExpandingBoundInTest
Oct 16, 2023
08114a4
Skip sequence related tests
Oct 16, 2023
907e2ec
Add CTETest skip markers and justification
Oct 17, 2023
28e6306
Skip WeCanSetDefaultSchemaWEventsTest with reasoning
Oct 17, 2023
f64cb87
Stop skipping ValuesExpressionTest
Oct 17, 2023
266df13
Skip UnicodeSchemaTest with reasoning
Oct 17, 2023
c8cae78
Stop skipping TableNoColumnsTest
Oct 18, 2023
691b5aa
Skip ServerSideCursorsTest
Oct 18, 2023
d4e0df9
Skip SequenceTest
Oct 18, 2023
03dd219
Skip RowCountTest
Oct 18, 2023
a7a7968
Add PostCompileParamsTest
Oct 18, 2023
86c4788
Skip NativeUUIDTest
Oct 18, 2023
7ddd1b2
Skip PercentSchemaNamesTest
Oct 18, 2023
9d323a0
Skip IsolationLevelTest
Oct 18, 2023
53db2ef
Skip FutureWeCanSetDefaultSchemaWEventsTest
Oct 18, 2023
5abfa18
Skip JSONLegacyStringCastIndexTest
Oct 18, 2023
0730eb9
Skip AutocommitIsolationTest(
Oct 18, 2023
8b9a140
Skip CollateTest
Oct 18, 2023
ed549ba
Skip ComputedReflectionTest and ComputedColumnTest
Oct 18, 2023
4a53fac
Skip SimpleUpdateDeleteTest
Oct 18, 2023
7ccac16
Skip SequenceCompilerTest
Oct 18, 2023
61c7911
Skip some of NormalizedNameTest with justification
Oct 18, 2023
d180144
Add final reviewed markers
Oct 18, 2023
2de4e91
Black all sqlalchemy source files
Oct 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/databricks/sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from databricks.sqlalchemy.base import DatabricksDialect
from databricks.sqlalchemy.base import DatabricksDialect
19 changes: 17 additions & 2 deletions src/databricks/sqlalchemy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class DatabricksImpl(DefaultImpl):
class DatabricksDialect(default.DefaultDialect):
"""This dialect implements only those methods required to pass our e2e tests"""

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

colspecs = {
sqlalchemy.types.DateTime: dialect_type_impl.DatabricksDateTimeNoTimezoneType,
Expand Down Expand Up @@ -109,7 +113,18 @@ def get_columns(
).fetchall()

if not resp:
raise sqlalchemy.exc.NoSuchTableError(table_name)
# TGetColumnsRequest will not raise an exception if passed a table that doesn't exist
# But Databricks supports tables with no columns. So if the result is an empty list,
# we need to check if the table exists (and raise an exception if not) or simply return
# an empty list.
self._describe_table_extended(
connection,
table_name,
self.catalog,
schema or self.schema,
expect_result=False,
)
return resp
columns = []
for col in resp:
row_dict = parse_column_info_from_tgetcolumnsresponse(col)
Expand Down
47 changes: 44 additions & 3 deletions src/databricks/sqlalchemy/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def temporary_tables(self):
def table_reflection(self):
"""target database has general support for table reflection"""
return sqlalchemy.testing.exclusions.open()

@property
def temp_table_reflection(self):
"""ComponentReflection test is intricate and simply cannot function without this exclusion being defined here.
Expand All @@ -181,9 +181,50 @@ def unique_constraint_reflection(self):
Databricks doesn't support UNIQUE constraints.
"""
return sqlalchemy.testing.exclusions.closed()

@property
def reflects_pk_names(self):
"""Target driver reflects the name of primary key constraints."""

return sqlalchemy.testing.exclusions.open()
return sqlalchemy.testing.exclusions.open()

@property
def datetime_implicit_bound(self):
"""target dialect when given a datetime object will bind it such
that the database server knows the object is a date, and not
a plain string.
"""

return sqlalchemy.testing.exclusions.open()

@property
def tuple_in(self):
return sqlalchemy.testing.exclusions.open()

@property
def ctes(self):
return sqlalchemy.testing.exclusions.open()

@property
def ctes_with_update_delete(self):
return sqlalchemy.testing.exclusions.open()

@property
def delete_from(self):
"""Target must support DELETE FROM..FROM or DELETE..USING syntax"""
return sqlalchemy.testing.exclusions.open()

@property
def table_value_constructor(self):
return sqlalchemy.testing.exclusions.open()

@property
def reflect_tables_no_columns(self):
return sqlalchemy.testing.exclusions.open()

@property
def denormalized_names(self):
"""Target database must have 'denormalized', i.e.
UPPERCASE as case insensitive names."""

return sqlalchemy.testing.exclusions.open()
Loading