Assigned
Status Update
Comments
[Deleted User] <[Deleted User]> #3
+1
jo...@gmail.com <jo...@gmail.com> #4
This bug causes headache. Would be nice to know if anyone is working on it, and how the progress is?
jo...@hm.com <jo...@hm.com> #5
Comment has been deleted.
jo...@hm.com <jo...@hm.com> #6
I have a possible workaround. It seem that limit 0 returns the correct schema. But since Big Query web gui does not show schema for empty results. You have to use a third party software or scripting
in my example you must replace @raw with your dataset name
--clean up
drop table if exists @raw.first_tbl;
drop view if exists @raw.second_vw;
create or replace table @raw.first_tbl ( id int64, name string );
create or replace view @raw.second_vw as select * from @raw.first_tbl;
-- investigate correct schema
select c.*
from @raw.INFORMATION_SCHEMA.VIEWS t
join @raw.INFORMATION_SCHEMA.COLUMNS c on c.table_name = t.table_name
where t.table_name='second_vw';
--update table to make information_schema_columns corrupted
create or replace table @raw.first_tbl
(
id int64,
name string,
age int64,
city string
);
-- investigate corrupt / invalid schema
select c.*
from @raw.INFORMATION_SCHEMA.VIEWS t
join @raw.INFORMATION_SCHEMA.COLUMNS c on c.table_name = t.table_name
where t.table_name='second_vw';
--workaround:
-- correct schema returned. But Big Query web gui does not show schemas for empty results. Use Data Dancer, scripting or other plugin to see schema
select * from @raw.second_vw limit 0
in my example you must replace @raw with your dataset name
--clean up
drop table if exists @raw.first_tbl;
drop view if exists @raw.second_vw;
create or replace table @raw.first_tbl ( id int64, name string );
create or replace view @raw.second_vw as select * from @raw.first_tbl;
-- investigate correct schema
select c.*
from @raw.INFORMATION_SCHEMA.VIEWS t
join @raw.INFORMATION_SCHEMA.COLUMNS c on c.table_name = t.table_name
where t.table_name='second_vw';
--update table to make information_schema_columns corrupted
create or replace table @raw.first_tbl
(
id int64,
name string,
age int64,
city string
);
-- investigate corrupt / invalid schema
select c.*
from @raw.INFORMATION_SCHEMA.VIEWS t
join @raw.INFORMATION_SCHEMA.COLUMNS c on c.table_name = t.table_name
where t.table_name='second_vw';
--workaround:
-- correct schema returned. But Big Query web gui does not show schemas for empty results. Use Data Dancer, scripting or other plugin to see schema
select * from @raw.second_vw limit 0
Description
This will create a public issue which anybody can view and comment on.
Please provide as much information as possible. At least, this should include a description of your issue and steps to reproduce the problem. If possible please provide a summary of what steps or workarounds you have already tried, and any docs or articles you found (un)helpful.
Problem you have encountered:
We have a script that manages updating our BQ views and tables. It will check to see if the schema of a particular view has changed to determine if tables derived from that view need to be recreated.
We noticed that if you modify the schema of a table that a view queries from, the view's schema is not automatically updated, even when querying from the view returns data in the new schema.
What you expected to happen:
The schema returned for the view should be updated.
Steps to reproduce:
foo
SELECT * FROM <table>
foo
bar
to the tablefoo
foo
andbar
foo
Other information (workarounds you have tried, documentation consulted, etc):