goccy / bigquery-emulator

BigQuery emulator server implemented in Go
MIT License
743 stars 86 forks source link

fix: prevent database rebuild when server starting #269

Open bjmmartin opened 3 months ago

bjmmartin commented 3 months ago

While using the emulator, we encounter the same error as https://github.com/goccy/bigquery-emulator/issues/207.

After looking a bit at the code, I found that when the server is starting, we try to reinsert all data, that are already in the database.

The proposal here is to rebuild the project only when the --data-from-yaml is provided. So if we found a project, and we are just loading from the database, we stop here, but if we load with the option it removes the project and its jobs and dataset, and rebuild it from scratch.

I don't know all cases, so it might break some edge case, maybe it could be an option to the command.

Let me know if some changes are required. And thanks a lot for the project 🙏

chrisK824 commented 1 month ago

Hey there @totem3 , have you seen this maybe? Is there a timeline estimate for this fix, if any?

Thanks im advance!