Re: Import csv to temp table
От | Adrian Klaver |
---|---|
Тема | Re: Import csv to temp table |
Дата | |
Msg-id | 84b1254f-b409-44b8-a2cf-d5e4c0e8d828@aklaver.com обсуждение исходный текст |
Ответ на | Re: Import csv to temp table ("Daniel Verite" <daniel@manitou-mail.org>) |
Список | pgsql-general |
On 1/2/24 06:51, Daniel Verite wrote: > arun chirappurath wrote: > >> Do we have any scripts that create a temp table with column names >> from the first row of csv files? > > csvkit [1] does that. > > [1] https://csvkit.readthedocs.io/en/latest/ In addition to the above which I have used you might want to take a look at: Polars https://pola.rs/ and Duckdb https://duckdb.org/ They both allow you to query CSV(and other format) files directly. I have found them very useful for looking at CSV files and you can transfer data elsewhere later. Then there is: Pandas https://pandas.pydata.org/pandas-docs/stable/index.html which has read_csv(https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html) and to_sql(https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_sql.html#pandas.DataFrame.to_sql) to pull from a CSV into a table. > > > Best regards, -- Adrian Klaver adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления: