I'm trying to create a simple bi tool similar to Power BI (see here).
You can see in Power BI that it allows the user to upload the CSV files (say with 10 million rows too). Once uploaded we can select a particular column in the csv files in the UI to create visualizations.
I was wondering how the database schema will look like for this particular operation? If the user could able to save 3,4,5 and n columns of csv, how the UI is so quick and response enough to get back the data? Are there any techniques for handling CSV data in Postgres sql?
Kindly help me out.
I'm a newbie to postgres and database in general.
Best Answer
To manage upload file, I use a simple table to save info of those files such as
file_name, file_path, upload_date
and more. The point here, I don't save those files in PG. I will upload them to other storage (Google Storage) and save path tofile_path
. For example:In terms of app, there are some libraries to handle UI (depends on your language). This app will retrieve CSV info from PG, base on that it will load data from storage and show to user.
You can use COPY command to process CSV data. But note that
Please read this article How to import CSV file data into a PostgreSQL table to know more .