Обсуждение: Ragged CSV import

Поиск
Список
Период
Сортировка

Ragged CSV import

От
"Little, Douglas"
Дата:

Hi,

In sept 2009 there was a discussion of ragged csv import and import requirements.

I thought I’d add my requirements to the heap.

 

I’m working a  QA solution for a dbms migration project that will import query output from a non PG database into PG, so  we can compare query results between PG and the alternative db.

The query are supposed to have the same values, but many things can get in the way.

 

My QA queries return a result set (multiple rows/columns) for each query.

 

Copy improvements that would be useful

1. Copy to non-existent table – create it from the data type using most generic datatypes

2. provide column mapping function  - from what I understand that the column list on a copy from is the target columns to load.  I assume there must be a header record and the same columns in the

Data file.

 

The improvements discuss in the forum would be very helpful.  Keep up the good work guys.

 

Doug Little

Sr. Data Warehouse Architect | Enterprise Data Management | Orbitz Worldwide

500 W. Madison, Suite 1000  Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164 | Cell 847-997-5741

Douglas.Little@orbitz.com

   orbitz.com | ebookers.com | hotelclub.com | cheaptickets.com | ratestogo.com | asiahotels.com 

 

Re: Ragged CSV import

От
Josh Berkus
Дата:
Douglas,

> 1. Copy to non-existent table - create it from the data type using most generic datatypes

Yes, that would be nice.  Types chosen would pretty much have to be
TEXT, NUMERIC, and TIMESTAMP for everything though; anything else is too
variable.

> 2. provide column mapping function  - from what I understand that the column list on a copy from is the target
columnsto load.  I assume there must be a header record and the same columns in the 
 

So, like:

COPY table1 ( cola, colb, colc ) FROM 'somecsv.csv' ( 'name', 'place',
'date') WITH CSV HEADER

... which would copy 'name' to cola, 'place' to colb, 'date' to colc,
and ignore any other columns present in the file?

--Josh Berkus