I want to load table from file and variable . As the file schema is not same as table to be loaded hence extra columns needs to be filled by variable inside stored procedure.
Like below example pty is not part of csv file and other 2 columns mt and de are part of file.
set pty = 'sss';
LOAD DATA INTO `###.Tablename`
(
pty STRING ,
mt INTEGER ,
de INTEGER
)
FROM FILES
(
format='CSV',
skip_leading_rows=1,
uris = ['gs://###.csv']
);
I think you can do that on 2 steps and 2 queries :
If it's complicated for you to apply your logic with Bigquery and SQL, you can also create a
Pythonscript withGoogle Biguery clientandGoogle storage client.Bigquery