[ 
https://issues.apache.org/jira/browse/DERBY-4555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380891#comment-15380891
 ] 

ASF subversion and git services commented on DERBY-4555:
--------------------------------------------------------

Commit 1752990 from [~bryanpendleton] in branch 'code/trunk'
[ https://svn.apache.org/r1752990 ]

DERBY-4555: Expand SYSCS_IMPORT_TABLE to accept CSV file with header lines
DERBY-6894: Enhance COLUMNINDEXES parsing for SYSCS_IMPORT_DATA

This patch was contributed by Danoja Dias (danojadias at gmail dot com)

The purpose of this patch is to allow the COLUMNINDEXES value to specify
columns in the input file by column header "name", as an alternate to
column index number. Column header names can be specified as double-quoted
strings, and you can mix-and-match indexes and names, so that
COLUMNINDEXES could be specified as:

    1,3,"LastName","FirstName",7

During the preparation of the input file for import processing, the
new "readHeaders" method that is added to the Import class will,
if 'skip > 0', open the input file, read the first 'skip' number of lines,
parse the column structure, and construct an array of the column headers,
then close the input file and return the headers array.

Then, the COLUMNINDEXES value, if it contains any column names, rather
than column index numbers, is matched against the headers array to
determine which column(s) to use.

> Expand SYSCS_IMPORT_TABLE to accept CSV file with header lines
> --------------------------------------------------------------
>
>                 Key: DERBY-4555
>                 URL: https://issues.apache.org/jira/browse/DERBY-4555
>             Project: Derby
>          Issue Type: Improvement
>          Components: Miscellaneous
>            Reporter: Yair Lenga
>            Assignee: Danoja Dias
>         Attachments: NoVarargs.diff, Varargs.diff, 
> addNewSystemProcedureWithTest.diff, addNewSystemProcedureWithTest_1.diff, 
> addNewSystemProcedure_1.diff, gotException.diff, hardCoded.diff, latest.diff, 
> noHeaderLines.csv, petlist.csv, petlist.csv, petlist.csv, repro.java, 
> repro.java, repro.java, skipHeaders.diff
>
>
> The SYSCS_IMPORT_TABLE (and SYSCS_IMPORT_DATA) function allow import of data 
> from external resources. In general, they can process CSV files that created 
> with various tools - with one exception: the header line.
> While there is no accepted standard, most tools will include a header line in 
> the CSV file with column names. This convention is supported in Excel and 
> many other tools.
> My Request: extend the SYSCS_IMPORT_TABLe and SYSCS_IMPORT_DATA (and other 
> related procedures) to include an extra indicator for the number of header 
> lines to be ignored.
> As an extra bonus it will be help is the SYSCS_IMPORT_DATA will accept column 
> names (instead of column indexes) in the 'COLUMNINDEXES' arguments. E.g., it 
> should be possible to indicate COLUMNINDEXES of '1,3,sales,5,'. This feature 
> will make it significantly easier to handle cases where the external input 
> files is extended to include additional columns.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to