Hello! I have question, I found out meltano cannot...
# getting-started
x
Hello! I have question, I found out meltano cannot read from PostgreSQL view as it lacks primary key (error:
primary key is set to mandatory
). Is it possible somehow to read from view? Is there a workaround to this? Thank you!
e
Wise's
tap-postgres
(https://hub.meltano.com/extractors/postgres) should be able to extract views
x
aha, thank you!
Hi @edgar_ramirez_mondragon it might be the tap we are using and it does not work on views
e
I saw you already asked in their repo 🙌
x
haha, waiting for their suggestions
a
Hi, @xinge_li. Certainly some database taps support views because I've used them in the past to work through odd table schema issues. If the tap-postgres you are using just completely ignores views (which seems a little odd to me), it may be worth trying another variant.
In terms of views not having primary keys, you have a few options I can think of: you can inject a the key properties declaration into the catalog if it is true for the view (meaning if it really does have a logical unique key), you can disable the primary-key-required setting on the target (if supported) or you can switch to a target which does not require primary keys.
Does this help?
x
Yes @aaronsteers thanks for the suggestion! The answer I got from tap-postgres (pipelinewise) is that this tap does not use a setting for primary key required. I will try with your advice on inject key properties.
s
I have a tap tap-sybase and I want to upsert the data based on data from a view. As stated above there is no primary_key defined for a view. I was however able to succeed by defining a primary_key and tricking the tap that it was seeing a table in the catalog rather than a view. This defined for me a primary key in the catalog and I am also seeing the primary key in the schema messages. Here is what I did using Meltano Environment variables. You can do the same thing in the meltano.yml file. export TAP_SYBASE__METADATA='{"dwh_extract-dwh_admission_source_tab": {"is-view":false, "replication-method": "FULL_TABLE", "table-key-properties": ["admission_source_code"]}}'