Skip to content

--ignoreheader not working #1

@jdrummey

Description

@jdrummey

Hi,

Using the extract tool on macOS I'm getting the following error:

jtd@cranberry small test % ./extract --schema 1table.json --ignoreheader --localread --overwrite
[INFO] Importing schema file 1table.json
[INFO] Schema Imported
[INFO] Overwriteing existing output.hyper file
[INFO] Creating new local Hyper instance
[INFO] Instance created. Building connection to output.hyper
[INFO] Connection established. Adding table to Hyper database
[INFO] The databse is ready to go. Let's get it populated
[INFO] Importing:   0%|                                                           | 0/1 [00:00<?, ?it/s][INFO] Header flag specified. Ignoring first row of each file
[INFO] SQLCMD: COPY table1 FROM 'table1.csv' WITH (FORMAT CSV) HEADER;
HYPER:11: syntax error: got "header", expected end-of-file
  Severity: ErrorSeverity.ERROR
  Detail Message: 
line 1, column 49: COPY table1 FROM 'table1.csv' WITH (FORMAT CSV) HEADER
                                                                   ^~~~~~
[ERROR] A fatal error occurred while populating the extract:
 None 
Exiting now.

Traceback (most recent call last):
  File "extract.py", line 201, in populateExtract
  File "site-packages/tableauhyperapi/connection.py", line 255, in execute_command
  File "site-packages/tableauhyperapi/impl/dllutil.py", line 118, in check
tableauhyperapi.hyperexception.HyperException: HYPER:11: syntax error: got "header", expected end-of-file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "extract.py", line 259, in <module>
  File "extract.py", line 252, in main
  File "extract.py", line 206, in populateExtract
NameError: name 'exit' is not defined
[14481] Failed to execute script extract

As far as I can tell all of the options in the WITH () need be within the parentheses and separated by commas, so an accurate command is:

COPY table1 FROM 'table1.csv' WITH (FORMAT CSV, HEADER)

I figured this out by looking at the Hyper API examples/create_hyper_from_csv.py, each of the options have a comma between them. The commas are also referenced in the Hyper docs for the COPY command: https://help.tableau.com/current/api/hyper_api/en-us/reference/sql/sql-copy.html.

This would require changing how the --delimiter and --ignoreheader options are handled in extract.py lines 176-199.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions