Skip to content

Unable to delete materialized view #75

@pgcamus

Description

@pgcamus

What happened?

Attempting to delete a materialized view using bq rm fails

$ bq rm -f pg_test.mv
BigQuery error in rm operation: failed to delete table mv: failed to delete table DROP TABLE `camus-unittest.pg_test.mv`: failed to exec DROP TABLE `camus-unittest.pg_test.mv`: SQL logic error: no such table: camus-unittest_pg_test_mv (1)

What did you expect to happen?

Attempting to delete a materialized view succeeds.

How can we reproduce it (as minimally and precisely as possible)?

Create a new dataset with a single table that is a trivial materialized view, and attempt to delete the table.

# Create the dataset and materialized view
$ bq mk -d pg_test
$ bq mk -t --materialized_view='select 1' pg_test.mv
$ bq ls pg_test
  tableId   Type    Labels   Time Partitioning   Clustered Fields  
 --------- ------- -------- ------------------- ------------------ 
  mv        TABLE

# Attempt to remove it
$ bq rm -f pg_test.mv
BigQuery error in rm operation: failed to delete table mv: failed to delete table DROP TABLE `camus-unittest.pg_test.mv`: failed to exec DROP TABLE `camus-unittest.pg_test.mv`: SQL logic error: no such table: camus-unittest_pg_test_mv (1)

# Show that it's still present
$ bq ls pg_test
  tableId   Type    Labels   Time Partitioning   Clustered Fields  
 --------- ------- -------- ------------------- ------------------ 
  mv        TABLE

Anything else we need to know?

Reproduced on ghcr.io/recidiviz/bigquery-emulator:0.6.6-recidiviz.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions