0

Due to some IT restrictions, I'm not able to integrate Tableau with our database. Instead I'm trying to build a pipeline that will upload csv query outputs to tableau. I know tableau only supports tde, tds, tdsx, and hyper files through their rest api. My understanding is that the hyper format has metadata as well as my data. If I were to use the hyper api to put my data into a hyper file, would I have any issues appending? Sample of my python code for creating the hyper file:

from tableauhyperapi import HyperProcess, Connection, TableDefinition, SqlType, Telemetry, Inserter, CreateMode
import csv

# Start a new private local Hyper instance
with HyperProcess(Telemetry.SEND_USAGE_DATA_TO_TABLEAU, 'myapp') as hyper:
    # Create the extract, replace it if it already exists
    with Connection(hyper.endpoint, 'mydb.hyper', CreateMode.CREATE_AND_REPLACE) as connection:
        schema = TableDefinition('foo', [
            TableDefinition.Column('a', SqlType.text()),
            TableDefinition.Column('b', SqlType.text()),
            TableDefinition.Column('c', SqlType.text()),
            TableDefinition.Column('d', SqlType.text()),
            TableDefinition.Column('e', SqlType.text()),
            TableDefinition.Column('f', SqlType.text()),
            TableDefinition.Column('g', SqlType.text()),
            TableDefinition.Column('h', SqlType.text()),
            TableDefinition.Column('i', SqlType.text()),
            TableDefinition.Column('j', SqlType.text()),
            TableDefinition.Column('k', SqlType.text()),
            TableDefinition.Column('l', SqlType.text()),
        ])
        connection.catalog.create_table(schema)
        with Inserter(connection, schema) as inserter:
            
            with open('YCE_new_sub_Jul_24_2023_2.42.59_AM.csv', newline='') as csvfile:
                data = list(csv.reader(csvfile))
            inserter.add_rows(data)
            inserter.execute()
justin
  • 169
  • 6
  • Tableau will happily read data directly from CSV files and, if they are all in the same location, can union them automatically. So a workflow based on adding CSVs to a folder might work fairly easily. – matt_black Aug 02 '23 at 16:35

0 Answers0