-
Notifications
You must be signed in to change notification settings - Fork 138
feat: Comment/description support, bug fixes and better test coverage #138
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
Changes from all commits
Commits
Show all changes
159 commits
Select commit
Hold shift + click to select a range
0fc64fa
Fixed a dependency problem that caysed test failures in Python 3.6.
bfdda68
Started implementing SqlAlchemy dialect-compliance tests
41cb2dd
Handle parameters in in
631c060
fixed regex to allow multi-character parameter names.
aa85cb9
Fixed rendering of string literals.
c7da257
Provide default values for primary keys and other fixes...
3916239
Narrowed skips and license comment diagnosed reasons for skipped fail…
46b30b4
use Google license
36a0033
Fixed like (% and _) escapes.
d079fbe
Handle BIGNUMERIC
7e60691
Skip tests that want to stpre floats as numeric.
4a1bafd
skip tests for offsets without limits. BigQuery doesn't allow that.
e07b1f0
BIGNUMERIC lets us handle many significant digits.test_many_significa…
656af06
Skip LongNameBlowoutTest because it requires features (indexes, prima…
a085db6
We have to rewrite these tests, because of forcing use_labels=True
681ea47
BigQuery returns deleted and updated rows, which SQLAlchemy doesn't e…
cde5bf8
Fixed a dependency problem that caysed test failures in Python 3.6.
76cf078
Provide a bigquery mock based on sqlite
ee46a1e
Don't force labels in select.
62432a3
merge riversnake-fix-78
a54b946
No need to work around forced labels anymore.
1320f32
Updated sqlite-bases mock
4f098fd
Added test that types are injected into parameter placeholders.
2c76342
Oops, need to call super even when there are where clauses.
68f9043
When SQLAlchemy thinks it knows a parameter type, include it in the p…
be1e215
Don't skip some numeric tests and skip some CTE tests
39f1955
Can't coerce datetime to date.
9e266f2
reenable some tests now that we pass type infor to bigquery
fa84c95
Enable error on warnings -- a test depends on it.
b01d2ce
Added table and column comment support.
dc91449
get_schema_names should return all of the schema names.
3743abe
Retrieval of view definitions.
dcc7e45
handle dateish literals.
163d031
BigQuery doesn't want schema names in column names.
c47a83d
Allow mutating table descriptions/comments.
9444c20
skip tests that depend on BigQuery keeping track of column details.
30c8ed7
Handle TIMESTAMP literals.
0ef4909
Fixed some broken TIMESTAMP tests.
99629cf
enabled more tests.
5e6e48d
remove extra lines.
83feb1e
blacken
896a082
added missing test for api.py
497cc90
Ignore flake8 complaint about * import.
7e5399a
lint and minor cleanup
e48dd58
Removed unused variable.
395a2d4
Get to 100% coverage in test_parse_url
07af7ef
Don't need because we can't test temp tables
ea99108
requirements.py -- It's used by compliance testing.
7039f05
Added Binary literal handling, and ...
0f2d315
Updated fauxdb to correct for some sqlite differences.
9db1e3b
Fixed santy check
50e3448
blackened
f449c5e
Added a test that exercises type handling for all the types.
d000075
Added table reference tests
190136e
test get_view_definition
acdd4d2
removed a private function that's never called.
3e73a0a
table and view list tests
4c6d72d
Moar unit tests and coverage
349269f
use latest bg release, because we depend on changes there.
717dd77
removed breakpoint that shouldn't have been checked in.
7ba7813
Bypass google authentication.
c22565e
Test JSON deserialization.
dc246ae
Test getting project id from authentication.
b914ee3
removed some unneeded code.
a7e49e9
Simplify string and binary literal processors to not expect None.
53883d5
Tested comment support
5b1e77e
Cleaned up comment handling.
beaf0b6
generalized options handling.
8236d5b
test dialect-options handling.
8e41b4d
constraints are ignored.
e9c5175
Better binary-literal hack
7835d2c
added tests for BIGNUMERIC.
dda37eb
Major rework using pickle to overcome type differences.
b774f79
Added array support
7a31d12
blacken
78be3cf
replaced an unreachable branch with an assert.
297e532
lint
0adebe1
Enable generation of random primary keys when running compliance tests.
21121e9
Run the select a couple of ways and assert result.
b942a61
Only generate random primary keys when running compliance tests.
4aeb0db
addd fetchall, needed by a test.
a8add9e
Port compliance tests
04aaee4
record when array size is set.
0e081a0
Added a tiny metadata convenience.
6fe196e
Added arraysize tests.
67733fd
exercise labels
725c5d5
Make sure label names are legal identifiers
cb56463
test disable quoting
58c3d55
simplifed a test.
d8e464a
Test forcing quote (even though quotes are forced anyway)
fabd4c6
Be more careful about doubled %s.
5cf4009
ported test for %%s
33642ff
Added IN tests.
401ad3b
handle UNNEST
2313f54
"inlined" some helper attrs
7e57563
moved setup_table to central location
534a819
ported a test that deals with bind params with indeterminate types
32f6b95
leverage setup_table
c762a9c
added a test based on sqlalchemy.testing.suite.test_select.LikeFuncti…
492530b
leverage setup_table
15ba275
Added test for labels in group by
a65bd1a
Added a test for compiling a single column.
ab873aa
Trying to compile a nameless column gives a meaningful error.
b1224c3
Get 100% coverage of fauxdbi
ba21553
Simplified quote decision.
445832e
Specify proto 4 when pickling, to get predictable behavior across Pyt…
2ef50bd
Some tests require sqlalchemy 1.3
5cd127a
require 100% test coverage.
ed81f2c
need newer sqlalchemy and google-auth
28e4f40
need sqlalchemy 1.2 because comments.
9616813
blacken/lint
0b1e85e
Added code to cleanup schemas at start to avoid spurious errors.
00d61f4
added copyright
c58f5f1
added copyright
7e826e1
fixed copyright
b469f3f
Updated the compliance setup
c021366
added copyright
5af39be
added copyright
a2e92a3
added copyright
e85558b
added copyright
c683b52
added copyright
b7bc62b
blacken
69c1d40
merge master
62d8df2
Make operational errors more informative.
b2ac135
Fixed better debugging support.
e5e9786
lint first
7625e61
Don't use upsert to update comments.
410b9ac
Older sqlite don't have true and false.
0b8e3f0
Ignore test debugging info added to deal with sqlite3 differences.
fa303d7
blacken
87f2846
Added minimal requirement for google-api-core to be consistent with s…
dc28277
Make the google-auth requirement consistent with the Python 3.6 test …
159fd18
chore(revert): revert preventing normalization (#132)
dandhlee 05528af
Explain why we add where clauses in delete statements that lack them
2db2dd4
Added a missing _ and explained \d+s in a regex
8ea13de
Fixed: didn't properly handle expansion of single-item arrays.
ae03721
Added test for expansion of single-element arrays
486873b
Avoid having to use an `_` to ignore a re group we don't care about.
a897d60
Added some comments for the tricky _get_field method.
6e4d5d6
Commented the pickle-protocol 4 prefixes we're looking for.
708f5db
explain use of pickle.
eeaae87
typo
ce6181f
BigQuery 2.15 wants google-api-core >= 1.23.0
877106b
blacken
ddd3399
don't need to call out the project in the test config.
e063e3e
Try sleeping between tests to see if we can avoid some weird failures.
7530acf
some minimal docs on the dialect tests.
4d99090
Update tests/sqlalchemy_dialect_compliance/README.rst
6b2a6b6
Update tests/sqlalchemy_dialect_compliance/README.rst
bc40df2
simplify by getting rid of unnecessary and broken overrriding.
ec4961c
merge upstream
16e302d
Try sleeping longer to avoid races between tests.
1e11ce2
make sure we wait for the drops at the beginning of the session.
ff35acf
rerun on table not found
b4c3c23
Try simpler regex
18ebe26
Try different error
fbbd563
don't sleep between tests.
a103ae8
blacken
5809a9c
removed unused import
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
# Copyright (c) 2021 The PyBigQuery Authors | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
# this software and associated documentation files (the "Software"), to deal in | ||
# the Software without restriction, including without limitation the rights to | ||
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
# the Software, and to permit persons to whom the Software is furnished to do so, | ||
# subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
""" | ||
This module is used by the compliance tests to control which tests are run | ||
|
||
based on database capabilities. | ||
""" | ||
|
||
import sqlalchemy.testing.requirements | ||
import sqlalchemy.testing.exclusions | ||
|
||
supported = sqlalchemy.testing.exclusions.open | ||
unsupported = sqlalchemy.testing.exclusions.closed | ||
|
||
|
||
class Requirements(sqlalchemy.testing.requirements.SuiteRequirements): | ||
@property | ||
def index_reflection(self): | ||
return unsupported() | ||
|
||
@property | ||
def indexes_with_ascdesc(self): | ||
"""target database supports CREATE INDEX with per-column ASC/DESC.""" | ||
return unsupported() | ||
|
||
@property | ||
def unique_constraint_reflection(self): | ||
"""target dialect supports reflection of unique constraints""" | ||
return unsupported() | ||
|
||
@property | ||
def autoincrement_insert(self): | ||
"""target platform generates new surrogate integer primary key values | ||
when insert() is executed, excluding the pk column.""" | ||
return unsupported() | ||
|
||
@property | ||
def primary_key_constraint_reflection(self): | ||
return unsupported() | ||
|
||
@property | ||
def foreign_keys(self): | ||
"""Target database must support foreign keys.""" | ||
|
||
return unsupported() | ||
|
||
@property | ||
def foreign_key_constraint_reflection(self): | ||
return unsupported() | ||
|
||
@property | ||
def on_update_cascade(self): | ||
"""target database must support ON UPDATE..CASCADE behavior in | ||
foreign keys.""" | ||
|
||
return unsupported() | ||
|
||
@property | ||
def named_constraints(self): | ||
"""target database must support names for constraints.""" | ||
|
||
return unsupported() | ||
|
||
@property | ||
def temp_table_reflection(self): | ||
return unsupported() | ||
|
||
@property | ||
def temporary_tables(self): | ||
"""target database supports temporary tables""" | ||
return unsupported() # Temporary tables require use of scripts. | ||
|
||
@property | ||
def duplicate_key_raises_integrity_error(self): | ||
"""target dialect raises IntegrityError when reporting an INSERT | ||
with a primary key violation. (hint: it should) | ||
|
||
""" | ||
return unsupported() | ||
|
||
@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 supported() | ||
|
||
@property | ||
def date_coerces_from_datetime(self): | ||
"""target dialect accepts a datetime object as the target | ||
of a date column.""" | ||
|
||
# BigQuery doesn't allow saving a datetime in a date: | ||
# `TYPE_DATE`, Invalid date: '2012-10-15T12:57:18' | ||
|
||
return unsupported() | ||
|
||
@property | ||
def window_functions(self): | ||
"""Target database must support window functions.""" | ||
return supported() # There are no tests for this. <shrug> | ||
|
||
@property | ||
def ctes(self): | ||
"""Target database supports CTEs""" | ||
|
||
return supported() | ||
|
||
@property | ||
def views(self): | ||
"""Target database must support VIEWs.""" | ||
|
||
return supported() | ||
|
||
@property | ||
def schemas(self): | ||
"""Target database must support external schemas, and have one | ||
named 'test_schema'.""" | ||
|
||
return supported() | ||
|
||
@property | ||
def implicit_default_schema(self): | ||
"""target system has a strong concept of 'default' schema that can | ||
be referred to implicitly. | ||
|
||
basically, PostgreSQL. | ||
|
||
""" | ||
return supported() | ||
|
||
@property | ||
def comment_reflection(self): | ||
return supported() # Well, probably not, but we'll try. :) | ||
|
||
@property | ||
def unicode_ddl(self): | ||
"""Target driver must support some degree of non-ascii symbol | ||
names. | ||
""" | ||
return supported() | ||
|
||
@property | ||
def datetime_literals(self): | ||
"""target dialect supports rendering of a date, time, or datetime as a | ||
literal string, e.g. via the TypeEngine.literal_processor() method. | ||
|
||
""" | ||
|
||
return supported() | ||
|
||
@property | ||
def timestamp_microseconds(self): | ||
"""target dialect supports representation of Python | ||
datetime.datetime() with microsecond objects but only | ||
if TIMESTAMP is used.""" | ||
return supported() | ||
|
||
@property | ||
def datetime_historic(self): | ||
"""target dialect supports representation of Python | ||
datetime.datetime() objects with historic (pre 1970) values.""" | ||
|
||
return supported() | ||
|
||
@property | ||
def date_historic(self): | ||
"""target dialect supports representation of Python | ||
datetime.datetime() objects with historic (pre 1970) values.""" | ||
|
||
return supported() | ||
|
||
@property | ||
def precision_numerics_enotation_small(self): | ||
"""target backend supports Decimal() objects using E notation | ||
to represent very small values.""" | ||
return supported() | ||
|
||
@property | ||
def precision_numerics_enotation_large(self): | ||
"""target backend supports Decimal() objects using E notation | ||
to represent very large values.""" | ||
return supported() | ||
|
||
@property | ||
def update_from(self): | ||
"""Target must support UPDATE..FROM syntax""" | ||
return supported() | ||
|
||
@property | ||
def order_by_label_with_expression(self): | ||
"""target backend supports ORDER BY a column label within an | ||
expression. | ||
|
||
Basically this:: | ||
|
||
select data as foo from test order by foo || 'bar' | ||
|
||
Lots of databases including PostgreSQL don't support this, | ||
so this is off by default. | ||
|
||
""" | ||
return supported() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.