Hi everyone - new to Meltano. I'm a heavy but ama...
# getting-started
g
Hi everyone - new to Meltano. I'm a heavy but amateur user of SSIS so that's my lens of experience. I'd like to load data from a CSV to a Postgres table using the target-Postgres. The tutorials I have used have created a new table in Postgres, but I'd like to load to a specific table. Is there a way to specify a table like you can in SSIS? I see you can choose a schema in the yaml but not sure how to load to a specific table. Thanks!
t
Which CSV tap are you using? The meltano variant? The name of the destination table in Postgres is controlled by the name of the stream coming from the tap, so... if you can get the name of the stream to match the name of a pre-existing table I would expect the data to be loaded into that. Assuming you're using the meltano CSV tap I would think that if you set the entity name in the csv_files_definition to the name of an existing table that might do the trick. Just an educated guess though!
g
Thanks for the reply. I thought about this but the table it created appended something to the name, so I assumed that it will create a new table rather than load to the emptied table. And you are right, I am using the meltano version of the tap. Is there a better approach for this? In SSIS I just ran a step truncating the table each time and reloading it since it was so fast.
t
The Postgres target (the Pipelinewise one, anyway) will only create the destination table if it doesn't exist. And the destination table name is determined by the stream name coming from the tap. So I think the question is still what the stream name coming from the tap is. If you send the output to tap-jsonl (i.e.
meltano elt tap-csv target-jsonl
what files get created? I'd be willing to bet the file produced by the JSONL target has the same name as the table being created in Postgres... which would at least confirm the issue is with tap-csv, not target-postgres.
a
Hi, @greg_vaslo! The
meltano
variant of
target-postgres
should be able to load the data into the truncated tables. As @thomas_briggs mentioned, the destination table name is the name of the stream coming from the tap. For example, with the following configuration for
tap-csv
, the tables
customers_tbl
and
orders_tbl
would be created in Postgres:
Copy code
config:
  files:
    - entity: customers_tbl
      path: customers.csv
      keys:
        - id
    - entity: orders_tbl
      path: orders.csv
      keys:
        - id
Can you check if the
entity
names you are using match your preferred destination table names in Postgres?