mini lab : BigQuery : 5 - GCS bucket missing customers.csv

Hello, every time I start the lab "mini lab : BigQuery : 5", I run

gcloud storage ls gs://<bucket_name>/customers.csv

and I get "ERROR: (gcloud.storage.ls) One or more URLs matched no objects.". I cannot load the CSV file into BigQuery if it is missing (getting "BigQuery error in load operation: Error processing job '<project_name>:bqjob_r3ca6793f2a6ee75a_00000195ca40fa4f_1': Not found: URI gs://<bucket_name>/customers.csv")

Screenshot_2025-03-24_17-24-06.png

0 4 191
4 REPLIES 4

The task must load the schema from local CSV file and upload it to the bucket:

  1. Load the schema from the local CSV file customers.csv into the customers table.
    So, the solution is:

 

gcloud auth list

PROJECT_ID=$(gcloud config get-value project)
BUCKET=${PROJECT_ID}-bucket

bq load --source_format=CSV --autodetect $PROJECT_ID:customer_details.customers customers.csv​

 

The solution above is work for me.

 

Task 1:Load schema from customers.csv into the customers table

In this task , we need to upload local -customers.csv as Bigquery table(customer_details.customers)

bq load --autodetect --source_format=CSV customer_details.customers ./customers.csv

by executing above command , Task1 is done

------------

Task 2:Create a new table named male_customers from the existing customers table that contains only the rows where the gender column is "Male" as well as the customer ID.

Problem starts now , local csv file has Gender Male, Female (there are 200 rows), but after uploading schema Bigquery table has only -Female (Gender) rows).

So we won't be able create table -male_customers with 'Male"(Gender) data , so we are not getting Check Task complete for Task2.

One more  its not customer ID , its CustomerID

----------------------------------------------------

Local customers.csv file example output

-------------------------------------------

CustomerID,Gender,Age,Annual Income,Spending Score
1,Male,19,15,39
2,Male,21,15,81
3,Female,20,16,6
4,Female,23,16,77
5,Female,31,17,40
6,Female,22,17,76

I have removed in between rows as it is lengthy

198,Male,32,126,74
199,Male,32,137,18
200,Male,30,137,83

----------------------------

customer_details.customers sample output

-------------------------------------------------------------

+------------+--------+-----+---------------+----------------+
| CustomerID | Gender | Age | Annual Income | Spending Score |
+------------+--------+-----+---------------+----------------+
| 3 | Female | 20 | 16 | 6 |
| 4 | Female | 23 | 16 | 77 |
| 5 | Female | 31 | 17 | 40 |
| 6 | Female | 22 | 17 | 76 |
| 7 | Female | 35 | 18 | 6 |
| 8 | Female | 23 | 18 | 94 |

in btween rows removed as it is lenthy

| 169 | Female | 36 | 87 | 27 |
| 175 | Female | 52 | 88 | 13 |
| 176 | Female | 30 | 88 | 86 |
| 181 | Female | 37 | 97 | 32 |
+------------+--------+-----+---------------+----------------+

Just now checked lab and all tasks are working fine. I am able complete lab

Top Labels in this Space