What would be the best way to enforce a unique constraint on a table that is created in BigQuery? I am creating the table by a DDL "create" statement and then I insert the contents.
Asked
Active
Viewed 1,921 times
1 Answers
2
BigQuery is not an operational database, instead it's an analytical database.
BigQuery doesn't support constraints, primary keys etc.
It's engineered for BigData and petabyte scale.
Pentium10
- 198,623
- 118
- 409
- 488
-
Agree, but I still have the practical problem of making sure a staging table that I import does not have duplicate rows. – denim Dec 04 '20 at 20:58
-
2Engineer to accept duplicate rows. On top of the table you create a VIEW that reads always the most recent row of an entity. That's how these engines work. https://stackoverflow.com/questions/25269410/google-big-query-sql-get-most-recent-column-value – Pentium10 Dec 04 '20 at 21:12