Skip to content

Always include where cluases in delete statements -- at least in test cleanup #6505

Description

@jimfulton

BigQuery doesn't allow a DELETE without a WHERE. Including at least a WHERE true (or maybe WHERE 1=1) in all deletes seems harmless.

For the BigQuery compliance tests, I overrode visit_delete in tests to provide a where clause when it was missing:

https://github.com/googleapis/python-bigquery-sqlalchemy/blob/d0edaea6b104e898859454fc363baf2d4a487d1b/tests/sqlalchemy_dialect_compliance/conftest.py#L48-L58

I only did this if teardown methods where in the stack, so it seems no tests would trigger a WHEREless `DELETE.

Maybe this is a BigQuery-specific issue and I should just override visit_delete in the BigQuery dialect to always add a where clause if none is provided.

Thoughts?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsuse casenot really a feature or a bug; can be support for new DB features or user use cases not anticipated

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions