how to automatically create table based on CSV into postgres using python
问题 I am a new Python programmer and trying to import a sample CSV file into my Postgres database using python script. I have CSV file with name abstable1 it has 3 headers: absid, name, number I have many such files in a folder I want to create a table into PostgreSQL with the same name as the CSV file for all. Here is the code which I tried to just create a table for one file to test: import psycopg2 import csv import os #filePath = 'c:\\Python27\\Scripts\\abstable1.csv' conn = psycopg2.connect(