How to programmatically import a CSV file as a table?
I am running the last version of Superset via Docker.
If I want to import a CSV file to Superset, I go through this route: Open Superset -> Sources -> Upload a CSV
I want to write a script that uploads a CSV file to superset. Is it possible to perform this task programmatically?
Issue-Label Bot is automatically applying the label #question to this issue, with a confidence of 0.88. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Might as well write a script that uploads data directly to your database (?)
I had to write a script to write my tables into the database.
@mistercrunch If I do that then I'd have to stop the Superset Server every time I upload the data to the postgreSQL database. I was wondering whether there was another way
@klazaj, why do you need to stop superset?
@davidhassan did you also run superset with docker? was your database the superset postgres?
@dpgaspar I thought I had to stop it because it was using the same postgres port, but apparently I don't need to
What I resorted to doing:
- copy file from local to live container:
docker cp file.csv container:/file.csv - enter live container:
docker exec -it container_id bash - login postgres database from within the container:
psql -U superset -d superset - create table in db and copy new table:
create table new (field type ...);
\copy new from 'file.csv' with delimiter as ',' csv header;
If someone knows a better way please comment below!