0

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.

Ismail
  • 980
  • 1
  • 3
  • 9
denim
  • 363
  • 1
  • 12

1 Answers1

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
  • 2
    Engineer 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