Skip to content

feat(sql): add delete() method to SQLBackend#11992

Open
jsouzadasilva wants to merge 3 commits into
ibis-project:mainfrom
jsouzadasilva:feat/add_delete_support
Open

feat(sql): add delete() method to SQLBackend#11992
jsouzadasilva wants to merge 3 commits into
ibis-project:mainfrom
jsouzadasilva:feat/add_delete_support

Conversation

@jsouzadasilva
Copy link
Copy Markdown

@jsouzadasilva jsouzadasilva commented Apr 15, 2026

This PR addresses the issue: #11205.

Adds a delete() method to SQLBackend for conditionally removing rows from tables, following the established insert()/upsert() patterns. The where parameter is required — passing None raises IbisInputError directing users to truncate_table() instead. Includes a BigQuery-specific override for catalog/database resolution matching the existing insert/upsert pattern.

The API design look like this:

con.delete("table_name", ibis._.salary > 200)
con.delete("table_name", lambda t: (t.run_datetime == val) & (t.run_id == rid))
con.delete("table_name", ibis._.run_id == "abc123", database="catalog.database")

We've tested the BigQuery delete locally against our GCP project and BigQuery dataset, using a simple python script. Here's a summary of the tests run:

  • test_1_delete_by_single_column
  • test_2_delete_by_compound_condition
  • test_3_delete_no_matching_rows
  • test_4_delete_with_deferred
  • test_5_delete_with_database_param
  • test_6_delete_where_none_raises

Add conditional row deletion via `delete(name, where, database=None)` to
SQLBackend, following the existing insert/upsert patterns. The `where`
parameter is required — passing None raises IbisInputError directing
users to truncate_table() instead. BigQuery override handles catalog/db
resolution matching the insert/upsert pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added tests Issues or PRs related to tests bigquery The BigQuery backend sql Backends that generate SQL labels Apr 15, 2026
Comment thread ibis/backends/bigquery/__init__.py
Comment thread ibis/backends/bigquery/__init__.py
Comment thread ibis/backends/bigquery/__init__.py
Comment thread ibis/backends/sql/__init__.py
Comment thread ibis/backends/sql/__init__.py
Comment thread ibis/backends/sql/__init__.py
Comment thread ibis/backends/sql/__init__.py
@jsouzadasilva jsouzadasilva changed the title feat(sql): add delete() method to SQLBackend feat(bigquery): add delete() method to SQLBackend Apr 15, 2026
@jsouzadasilva jsouzadasilva changed the title feat(bigquery): add delete() method to SQLBackend feat(sql): add delete() method to SQLBackend Apr 15, 2026
@dtran-im
Copy link
Copy Markdown
Contributor

@cpcloud Hello again. Wondering if you would approve the full test suite to run on this PR?

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

Labels

bigquery The BigQuery backend sql Backends that generate SQL tests Issues or PRs related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants