1

I have a table called solar_system_volatiles in my Astra Datastax serverless database. I'm trying to copy data from a .csv file into a table on Astra db. The code I've tried is below in the image.

However, i'm having an issue where I am not allowed to copy the data from a .csv into the Datastax table. I believe this could be due to the fact the .csv file is in a Box folder.

I'd like to know your thoughts and possible reasons as to why this might be occurring.

Code used to access table and upload data into table

James Z
  • 12,209
  • 10
  • 24
  • 44
Martin
  • 61
  • 2
  • 9

2 Answers2

0

The CQL console in Astra does not permit file I/O in that regard. For loading a CSV I would recommend using DS Bulk in combination with your secure bundle.

dsbulk load -url <path-to-csv-file> -k <keyspace_name> -t <table_name> -b <path-to-secure-connect-bundle> -u <client_id> -p <client_secret>
Andrew
  • 26,629
  • 5
  • 63
  • 86
0

Another way to load a CSV (as long as the file is < 40 MB), is to use the Data Loader from the Astra dashboard.

For this example, I have clicked into my database named "workshops." The "Load Data" button is visible in the upper-right corner, as shown below:

Click on the "Load Data" button in the upper-right corner.

Clicking that button will take you to the Data Loader page. From here, you can drag a CSV file into the middle area with the gray outline (shown below). You can also click it and browse to the CSV file.

Click or drag a CSV file into the middle area.

Once the file loads, you should see a message stating "Upload Successful" along with a blue "Next" button, which you should click. On the next screen, you can specify the table name, assign column types, and designate your primary keys:

Clarify the table metadata between the file and the table.

Important to note, but if the table will be created if it does not exist.

Aaron
  • 55,518
  • 11
  • 116
  • 132