I've been reading the bigquery documentation since late last night and understand very little of it. It talks about loading data via different methods, but doesn't say how to create the table that I'm going to load data into. When I use the web UI it expects me to type out the schema. My table has over 400 columns. I will not type out hundreds of column names, types and lengths.
I've been uploading hundreds of GB of data in csv format to a google bucket. The csv files do not have column names. I have the schema in sql format which I prefer to use.
If I try creating a table through a query I get an error already on line 2 that says,
"Error: Encountered "" at line 2, column 1."
CREATE TABLE [example-mdi:myData_1.ST] (
`ADDRESS_ID` varchar(9),
`INDIVIDUAL_ID` varchar(2),
`FIRST_NAME` varchar(25),
`LAST_NAME` varchar(2),...
How can I do this or what is the right way?
You can use a CREATE TABLE
statement to create the table using standard SQL. In your case the statement would look something like this:
CREATE TABLE `example-mdi.myData_1.ST` (
`ADDRESS_ID` STRING,
`INDIVIDUAL_ID` STRING,
`FIRST_NAME` STRING,
`LAST_NAME` STRING,
...
);
Mikhail is right and gets credit for the answer. If you're as slow as me you're going to want more details, because after he pointed me the right way it still took a while to figure out what he's talking about and how to get it done.
When you're at the create table user interface click the "edit as text" link.
In the text box input that pops up you'll enter something like:
ADDRESS_ID:string,
INDIVIDUAL_ID:string,
First_name:string,
Last_name:string...
Hyphens are not permitted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With