Export Data from BigQuery to Cloud Storage

A passionate full-stack developer from @ePlus.DEV
Search for a command to run...

A passionate full-stack developer from @ePlus.DEV
No comments yet. Be the first to comment.
Quick and practical tips to help users optimize tasks, improve skills, and solve common problems effectively across various areas like tech, lifestyle, productivity, and more.
Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary Vercel AI Gateway thêm Grok Imagine Image 2.0 Preview, đưa image gene

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary Cloudflare đang hợp nhất Workers AI và AI Gateway thành một control p

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary GitHub thay đổi hành vi của Code Quality: bật Code Quality sẽ không c

Một bản tin giúp Developer cập nhật nhanh AI, Cloud, Open Source và những công nghệ đáng chú ý trong ngày. 📌 Executive Summary OpenAI thay đổi thời điểm tính phí seat mới của ChatGPT Business từ n

Overview Dataplex is an intelligent data fabric that enables organizations to centrally discover, manage, monitor, and govern their data across data lakes, data warehouses, and data marts to power ana

Labs are timed and cannot be paused. The timer starts when you click Start Lab.
The included cloud terminal is preconfigured with the gcloud SDK.
Use the terminal to execute commands and then click Check my progress to verify your work.
You want to export the data that contains the specific information and store it in the cloud storage bucket. You have a csv file (customers.csv) locally that contains customer information. Also, a cloud storage bucket (qwiklabs-gcp-04-58870faf67f8-bucket), bigquery dataset customer_details and a table customers are available to you. The precreated bucket already has the customers.csv file.
You need to complete the following tasks:
customers.csv into the customers table.Click Check my progress to verify the objective.
Load the schema from local 'customers.csv' file into the customers table.
male_customers from the existing customers table that contains only the rows where the gender column is "Male" as well as the customer ID.Click Check my progress to verify the objective.
Create a 'male_customers' table from the existing 'customers' table.
male_customers table to an existing Google Cloud Storage bucket in CSV format as exported_male_customers.csv file.Click Check my progress to verify the objective.
Export the 'male_customers' table to an existing Google Cloud Storage bucket.
curl -LO raw.githubusercontent.com/ePlus-DEV/storage/refs/heads/main/labs/export-data-from-big-query-to-cloud-storage/lab.sh
source lab.sh
bq load --source_format=CSV --autodetect customer_details.customers customers.csv
bq query --use_legacy_sql=false --destination_table customer_details.male_customers 'SELECT CustomerID, Gender FROM customer_details.customers WHERE Gender="Male"'
PROJECT_ID=$(gcloud config get-value project)
bq extract customer_details.male_customers gs://${PROJECT_ID}-bucket/exported_male_customers.csv
bq query --use_legacy_sql=false --replace --destination_table=customer_details.male_customers 'SELECT CustomerID, Gender FROM customer_details.customers WHERE Gender = "Male"'