Skip to content

test: fix numeric compliance test #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
22 changes: 22 additions & 0 deletions google/cloud/sqlalchemy_spanner/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,25 @@ def get_isolation_levels(self, _):
dict: isolation levels description.
"""
return {"default": "SERIALIZABLE", "supported": ["SERIALIZABLE", "AUTOCOMMIT"]}

@property
def precision_numerics_many_significant_digits(self):
"""target backend supports values with many digits on both sides,
such as 319438950232418390.273596, 87673.594069654243

"""
return exclusions.open()

@property
def precision_numerics_retains_significant_digits(self):
"""A precision numeric type will return empty significant digits,
i.e. a value such as 10.000 will come back in Decimal form with
the .000 maintained."""

return exclusions.open()

@property
def precision_numerics_enotation_large(self):
"""target backend supports Decimal() objects using E notation
to represent very large values."""
return exclusions.open()
7 changes: 4 additions & 3 deletions google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ def visit_large_binary(self, type_, **kw):
def visit_DECIMAL(self, type_, **kw):
return "NUMERIC"

def visit_NUMERIC(self, type_, **kw):
return "NUMERIC"

def visit_VARCHAR(self, type_, **kw):
return "STRING({})".format(type_.length or "MAX")

Expand All @@ -250,6 +247,9 @@ def visit_BOOLEAN(self, type_, **kw):
def visit_DATETIME(self, type_, **kw):
return "TIMESTAMP"

def visit_NUMERIC(self, type_, **kw):
return "NUMERIC"

def visit_BIGINT(self, type_, **kw):
return "INT64"

Expand All @@ -276,6 +276,7 @@ class SpannerDialect(DefaultDialect):
supports_sequences = True
supports_native_enum = True
supports_native_boolean = True
supports_native_decimal = True

ddl_compiler = SpannerDDLCompiler
preparer = SpannerIdentifierPreparer
Expand Down
Loading