google-big-queryHow do I upload a CSV file to Google BigQuery?
- First, create a Google Cloud Storage bucket.
- Next, use the
bq
command line tool to upload the CSV file to the bucket.bq load --source_format=CSV <dataset>.<table> <csv file> <schema>
- Then, create a BigQuery table in the desired dataset.
- Finally, use the
bq
command line tool to load the CSV file into the table.bq load --source_format=CSV <dataset>.<table> gs://<bucket>/<csv file> <schema>
The bq
command line tool can be used to upload a CSV file to Google BigQuery. The command consists of the following parts:
bq
: the command line toolload
: the command to load data--source_format=CSV
: the source format of the data (in this case, CSV)<dataset>.<table>
: the destination dataset and table<csv file>
: the CSV file to be uploaded<schema>
: the schema of the table
If the CSV file is stored in a Google Cloud Storage bucket, the gs://<bucket>/<csv file>
should be used instead of <csv file>
in the command.
Helpful links
More of Google Big Query
- How can I use Google Big Query to count the number of zeros in a given dataset?
- How do I use Google Big Query to zip files?
- How can I use Google BigQuery ML to build a machine learning model?
- How can I use Google BigQuery to retrieve data from a specific year?
- How can I use Google Big Query to integrate with Zephyr?
- ¿Cuáles son las ventajas y desventajas de usar Google BigQuery?
- How can I use Google Big Query to process XML data?
- How do I use the YEAR function in Google BigQuery?
- How do I use Google Big Query with Excel?
- How can I use Google BigQuery to wait for a query to complete?
See more codes...