Loading Data into Snowflake table from a CSV file - excel

I've been trying to add data from a csv file into snowflake database. I use the load data GUI option to upload the data. The problem is that since it is a CSV file ',' is the delimiter and the data inside one of the columns has , in it so it is considering it as a delimiter and splitting the columns. Can you suggest a way to upload the data without the above case happening?
Thanks.

Related

Automatic change in data type when reopening CSV file

After changing Data type of column from General or Number to Text and saving as CSV file (column has Numbers only). When you reopen the file the data type is getting changed back to General automatically.
How to stop it getting changed automatically ? I need the change made in CSV file format for uploading to big query.
Thanks.
I tried VBA, data transformation in excel, Text function, Putting ' in front of number, Text to Columns option.
CSV has no data type but you can bigquery load with schema
load with schema
ex using bq load with schema string
bq load --source_format=CSV mydataset.mytable ./myfile.csv schema:STRING,string:FLOAT
or with schema file
bq load --source_format=CSV mydataset.mytable ./myfile.csv schema.json

How to prepend a single line to a csv file in Azure Data Factory?

I have a csv/txt file in Azure Blob Storage of the form:
Column1
Column2
Column3
data
data
data
In the text file it looks like:
Column1, Column2, Column3, etc.
data, data, data, etc.
I am attempting to prepend a single line in ADF as the first line in the file so that it looks like:
BATCH IMPORT, IMPORT 1.0 (the comma is included in this line)
Column1, Column2, Column3, etc.
data, data, data, etc.
I have attempted to use merge files, changed the delimiting around but can't seem to make it work. There is no need to work with the data after this line has been prepended. I will be using a binary copy activity to send it to its destination once the line has been added. Is there any way to achieve this in ADF without using external sources like Azure Functions or Batch Services?
Thanks for helping in advance.
Edit: I would also be happy to work with Azure Functions for this as well if that is possible?
We can use data flow in ADF to achieve that.
We can add a csv or text file contains the header BATCH IMPORT, IMPORT 1.0 to Azure Blob Storage.
Then at source1 we connect to the source csv.
Select No delimiter at source dataset.
Data preview is as follows:
Add another source of headers.txt, which contains the single line BATCH IMPORT, IMPORT 1.0 .
The same, select No delimiter at the dataset.
Data preview is as follows:
Union header and source1 at Union1 activity
Data preview is as follows:
Then we can sink to a csv
We had the same requirement recently (well, we wanted to append rows to a csv in blob).
Waiting 5 mins to spin up a Spark cluster to do this seemed like overkill so our workaround was to read it into a table in SQL, append the data in a proc there and write back to blob.
Maybe not elegant but it does the job!

Insert records from CSV file into Oracle, with NodeJs

I have a concern working with Oracle, TypeOrm, and NodeJs.
How can I input 1 million records found within a csv file?
The point is that I have to load the content of an xlsx file to a table in oracle, this file has around 1 million data or more.
The way I was doing this task was, converting from xlsx to json and from json, and that array save to database, but it was taking too long.
So now I transform to CSV, but how can I insert all the records from the CSV file into the oracle table?
I am using TypeOrm for the connection between Oracle and NodeJs

Removing extra comma from a column while exporting the data into csv file using Azure Data Factory

I am having data in my sql table as shown below screenshot, which is having an extra comma in values column after the values. It is actually list of values which is having more values.
I have to import this data into a pipe delimited csv file. And it is shown as below screenshot.
How will I remove the additional comma from that column while importing the data into a csv file with pipe delimiter.
I am performing the import using an azure data factory pipeline. Is there any way to avoid the extra comma from imported file or while importing?
Is there any way to make this changes at the time of importing the file to an ADLS location through ADF? Any changes that has to be make in ADF?
As Joel commented, you can just modify your query to do that while extracting. It might look like this:
select ID, timestamp, replace([values], ',', '') as values from [YourTable]
Hope this helped!

Data Load from CSV file to SQL DB using ADF

I am having a.CSV file and I am trying to load to SQLDB using azure data factory but in the CSV file there is a column "Address" in that column there is comma in between address so ADF is splitting that column into multiple columns because CSV stands for (comma-separated values) and because of that address column is being split into multiple columns is there any way to resolve this issue.
In your Dataset, try changing the 'Column delimiter' to another character other than ','.
According you description, It's sure that the csv file using the comma as column delimiter.
Change the dataset column delimiter to Pipe(|) doesn't works.
For this question, others have asked the same questions in Stack overflow. Data factory do not support change the csv file schema during Copy Active or Data Flow.
I also asked Azure Support for helps before, the only way they suggest me is that change the source csv file.
Hope this helps.

Resources