I am pretty new in bigquery. I have created bigquery table from gcp console where GCS CSV file is used as data source. I think when i delete any row, that should also be deleted from GCS file. But practically it's not happening.
2 Answers
When you use BigQuery, you have 2 ways to load data from GCS CSV file.
- The most common, is to perform a load job. This means that your CSV data are loaded (copied) into a BigQuery native table. After the load, there no link maintained between the file and the BigQuery data.
In this case, it's normal that the file doesn't change when you delete data into BigQuery
- You can define external table and query directly the data into your file hosted in GCS. It prevents the data duplication but the query are slower. In addition, DML (Data Manipulation Language) statements (INSERT, UPDATE, DELETE) aren't supported on external table.
Workaround
As workaround, your can use the solution 1:
- load the data from the CSV file to a BigQuery native table
- Delete the rows that you want
- Export the BigQuery table to CSV.

- 66,369
- 2
- 47
- 76
As you can see in the image below, BigQuery
supports three types of tables: Native, External and Views
When you create a Native Table, your data is fully imported into BigQuery
's storage system and transformed in order to be optimized for queries.
An External Table is basically a pointer to your source files. In other words, every time you run a query against an External Table, BigQuery
access the original source of data (some file in GCS, Google Driver, etc..)
Given that, I can go directly to your question: BigQuery will not update the source files when you run some DML statement. If you run a DML statement (DELETE, UPDATE) against a Native table, the data inside BigQuery's storage system will be changed but the files will not be touched.
Also, DML is not supported in External Tables. If you try to run a DELETE statement agains an External Table for example you will get an error: DML over table 'project.dataset.table' is not supported.
I strongly recommend that you take a look in this documentation

- 3,870
- 7
- 23