3
votes

I'm receiving this error when querying a view:

A view from this query references an old version of a table that might be incompatible. Please delete and re-create [myDataset.myTestView].

I created the view yesterday, and I'm certain that the table structure has not changed, ie no new columns, no columns were deleted and so on. However, the table was actually dropped and re-created nightly. Is this the cause of my problem?

How should/can I overcome this?

1

1 Answers

2
votes

BigQuery saves the internal name of your table in the view. When you delete a table and recreate it, the internal name changes, even if the external name is the same. Note that this is deliberate, so that you don't actually refer to the wrong table, or a table that has a different schema.

If you delete a table that is referenced in a view, you will need to update the view to point at the table. An empty patch operation should suffice, however.