bigquery-emulator icon indicating copy to clipboard operation
bigquery-emulator copied to clipboard

Truncate table not working

Open Ojasv-Singh-Zeotap opened this issue 1 year ago • 2 comments

What happened?

String q = String.format("truncate table %s.%s", getDatasetId(), getTableId()); runQuery(bigQuery, q)

Error

failed to truncate DELETE FROM `test-dataset.records`: no such table: test-dataset.records

What did you expect to happen?

table should be truncated

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

create a table and try to truncate it

Anything else we need to know?

No response

Ojasv-Singh-Zeotap avatar Dec 17 '24 15:12 Ojasv-Singh-Zeotap

String q = String.format("delete from `test-dataset.records` where true",  getDatasetId(),  getTableId());
runQuery(bigQuery, q)

this works as expected

Ojasv-Singh-Zeotap avatar Dec 17 '24 15:12 Ojasv-Singh-Zeotap

I've implemented and released a fix for the TRUNCATE statement in the Recidiviz fork of the emulator https://github.com/Recidiviz/bigquery-emulator/releases/tag/v0.6.6-recidiviz.0

ohaibbq avatar Nov 08 '25 18:11 ohaibbq