Reputation: 3
I have a working node.js Google Cloud Function that grabs a csv from a Google Cloud Storage Bucket and then imports it into my google cloud sql DB (PostgreSql). I used the node.js code shown here almost exactly: https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/instances/import
Is it possible to add a column to the csv/data import that contains a text string of the CSV file name as shown in cloud storage? For example, if my csv had columns 'col1' and 'col2' with data and the file name is 'example_import.csv' I would like the final import to look like this:
Col1 | Col2 | file_name |
---|---|---|
Data | Data | example_import |
Data | Data | example_import |
I have searched many different forums for some time and have not been able to find a straight answer on this.
Upvotes: 0
Views: 330
Reputation: 3565
Two ways to do this:
Upvotes: 0