About Removing the duplicate CSV files or rows from bigquery Table - csv

I created a table in BigQuery In Cloud Application . By mistake I uploaded two csv files in a bigquery Table.
How to delete either one or both csv file from bigquery table?
Thanks
Arvind

Unfortunately, there is currently no way to remove data from a BigQuery table. Your best option is to re-import the data in a new table. (If you no longer have the original CSV, you can export the table and then remove the duplicates before re-importing.)

Related

Bigquery - INSERT into Existing table - from local CSV

In Bigquery - I want to create a table, then load the table from a csv file on my local drive in a single query.
I know the Statements below are not correct, looking for an exmaple of how to do it.
I can create the table, I am not able to insert, or is there another method (upsert, merge???)
CREATE OR REPLACE TABLE Project1.DataSet_Creation.tbl_Store_List_Full
( Store_Nbr string(255),Sister_Store string(255))
,
INSERT INTO Project1.DataSet_Creation.tbl_Store_List_Full (Store_Nbr,Sister_Store)
FROM C:\GCP_Transition\tbl_Store_List_Full.csv
AFAIK, for this purpose you need to use the Bigquery web UI, in a project tab click the create table and choose the CSV file as upload method, enable the auto detect if it is disabled and header rows to skip as 1 so that Bigquery will take your columns as proper of the CSV file with no title row as the docs suggest.
https://cloud.google.com/bigquery/docs/loading-data-cloud-storage-csv#loading_csv_data_into_a_table

How to import single CSV file with more than one table to MySQL database

I've just found that I can import a CSV file to MySQL table. I tried it on phpMyAdmin, but I also found out that by importing a CSV file, its columns need to match the mysql database table you are importing to. This means one CSV file equals one table only in the SQL database, correct me if I'm wrong though.
The problem is the employee table I'm inserting data to, is related to other tables. There's also the rolemap table where when every employee is inserted in the employee table, the rolemap table also creates a new row for that new employee(only inserts the employee_id generated by the employee table, then the role of the user if admin or not).
The question is can I achieve this logic, by importing a CSV file in phpMyAdmin or any database manager? I'm thinking that maybe there will be some formatting that needs to be done in the CSV file in order to import to different tables in the database. Or is this not possible, that I need to parse the CSV file in a backend and handle how to insert it to each respective table in the database?

Hive - external tables and csv data

I need some help from you with a problem of understanding refrencing data from hive. The following situation: I have a CSV fil data.csv imported into hadoop. Now I have found many snippets that use an external table to create a schema on top of the csv file. My question is, how does hive know that the schema of the external table is connected to data.csv. In examples I cannot find a reference to the csv file.
Where is sample_1.csv referenced for usage in this hive example or how does hive know that data from sample_1.csv includes the data?
While creating external table we have to give the list of columns and hdfs location. Hive will store only column metadata like column name, datatype.. and the hdfs location.
When we execute query on external table it will fetch metadata and then fetch available files from hdfs location.
now we've got the answer. The manual recommends to store one file in one directory. When we then build an external table on top it seems that the data ist identified by the schema.
In my Testcase i have imorted 3 csv files with one schema 2 files got the matching schema. The third file got one column more. If i run a query the data of all three files are shown. The additional column from the third file is missing.
Everything is fine now - thank you!

BigQuery append data from csv to column

I have a BigQuery table where I added a new column and am not sure as to how I can append data to its row.
This is the BigQuery table:
This is the csv/excel file: I did try to upload the csv directly as a new table but had errors and am now trying to update the column named 'Max_Takeoff_kg', its the last column in the csv. How do I write a query within BigQuery to update the rows with the data in the csv in the last column.
If you're loading your data only for this time, I'd recommend that you save your XLS as CSV and try to create a new table again.
Anyway, you can update your table using BigQuery DML as you can see here
Its important to remember that in your case, for this approach works correctly you must have a way to identify your rows uniquely.
Example:
UPDATE your_db.your_table
SET your_field = <value>
WHERE <condition_to_identify_row_uniquely>
I hope it helps

Quickest way to populate a table in MySQL via phymyadmin

I have about 8000 records in an Excel file and wish to add them to a MySQL table. I need to know the quickest way to populate the table.
Save the Excel worksheet as a .CSV file, and use the MySQL LOAD DATA statement to read the .CSV file and insert rows to a table. That's the quickest.