How to create a new table into database(PostgreSQL or MongoDB) when upload a new csv file!?

Hello!
I am new into dash! I want to ask how can I create a new table into an existing database every time I make a new CSV file upload from dcc.upload, the header of the CSV file will be the table components!? So when I want to upload a new CSV file from user upload, a new table need to be created automatically with all the data inside the file into an existing database!
I really need help on this one, can anyone help me on this?