Skip to content

Commit

Permalink
gate bucketing queries on sqlalchemy version (#6841)
Browse files Browse the repository at this point in the history
* gate bucketing queries on sqlalchemy version

* add comment

* adjust comment
  • Loading branch information
prha committed Mar 2, 2022
1 parent 0ac9e1c commit fe4a530
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ def upgrade(self):
out-of-date instance of the storage up to date.
"""

@property
def supports_bucket_queries(self):
# This is a temporary stopgap until we can either pin SQLAlchemy>=1.4.0 (blocked by airflow
# compat issues) or switch the bucketing query to use backwards-compatible syntax (that
# avoids calling `.subquery` on a select statement).
return db.__version__ >= "1.4.0"

def fetchall(self, query):
with self.connect() as conn:
result_proxy = conn.execute(query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ def _alembic_downgrade(self, rev="head"):

@property
def supports_bucket_queries(self):
return get_sqlite_version() > MINIMUM_SQLITE_BUCKET_VERSION
return (
super().supports_bucket_queries and
get_sqlite_version() > MINIMUM_SQLITE_BUCKET_VERSION
)

def upgrade(self):
self._check_for_version_066_migration_and_perform()
Expand Down

0 comments on commit fe4a530

Please sign in to comment.