revanth_peddi
07/15/2021, 6:40 AMPrimary key is set to mandatory but not defined in the XXXX stream. Exception: key_properties field is required .charley_guillaume
07/15/2021, 11:03 AMdouwe_maan
07/15/2021, 3:34 PMrevanth_peddi
07/15/2021, 3:52 PMid , it’s some custom column namedouwe_maan
07/15/2021, 3:57 PMid. What is the type of the primary key?revanth_peddi
07/15/2021, 4:12 PMrevanth_peddi
07/15/2021, 4:14 PMrevanth_peddi
07/15/2021, 4:15 PMmeltano config tap-postgres-XXXX set _metadata public-XXXX table-key-properties '["XXXX", "XXXX"]'douwe_maan
07/15/2021, 4:16 PMdouwe_maan
07/15/2021, 4:17 PMdouwe_maan
07/15/2021, 4:17 PMmeltano.yml , so that I can verify it looks correct?revanth_peddi
07/15/2021, 4:33 PM- name: tap-postgres-xxxxx
inherit_from: tap-postgres
model_name:
config:
port:
user:
dbname:
default_replication_method: LOG_BASED
host:
ssl:
streams:
- name: stream_xxxxx
table: public-xxxxx
datetime_key: updatedat
select:
- public-xxxxx
metadata:
public-xxxxx:
replication-key: updatedat
table-key-properties:
- schemaiddouwe_maan
07/15/2021, 4:36 PMdouwe_maan
07/15/2021, 4:40 PMrevanth_peddi
07/15/2021, 4:40 PMdouwe_maan
07/15/2021, 4:43 PMtable-key-properties show up in meltano elt … --dump=catalog as expected?revanth_peddi
07/15/2021, 4:48 PMrevanth_peddi
07/15/2021, 4:48 PM"breadcrumb": [],
"metadata": {
"table-key-properties": [],douwe_maan
07/15/2021, 4:49 PMcatalog: path in meltano.yml , are you?douwe_maan
07/15/2021, 4:50 PMtap-postgres-xxxxx inherits from tap-postgres , is that defined separately?revanth_peddi
07/15/2021, 4:51 PMrevanth_peddi
07/15/2021, 4:51 PMdouwe_maan
07/15/2021, 4:51 PMpublic-xxxxx matches the tap_stream_id for the stream in question?revanth_peddi
07/15/2021, 4:53 PMpublic-xxxxx matchesdouwe_maan
07/15/2021, 4:55 PMselect: [public-xxxxx] resulting in the selected:true metadata being set correctly on that stream, but not any others?douwe_maan
07/15/2021, 4:55 PMselect would work but metadata wouldn’t 😕revanth_peddi
07/15/2021, 5:03 PMrevanth_peddi
07/15/2021, 5:04 PM[2021-07-15 17:02:25,034] {subprocess.py:79} INFO - target-postgres-staging | time=2021-07-15 17:02:25 name=target_postgres level=CRITICAL message=Primary key is set to mandatory but not defined in the [public-XXXXX] stream
[2021-07-15 17:02:25,036] {subprocess.py:79} INFO - target-postgres-staging | Traceback (most recent call last):
[2021-07-15 17:02:25,037] {subprocess.py:79} INFO - target-postgres-staging | File "/project/.meltano/loaders/target-postgres-staging/venv/bin/target-postgres", line 8, in <module>
[2021-07-15 17:02:25,037] {subprocess.py:79} INFO - target-postgres-staging | sys.exit(main())
[2021-07-15 17:02:25,038] {subprocess.py:79} INFO - target-postgres-staging | File "/project/.meltano/loaders/target-postgres-staging/venv/lib/python3.6/site-packages/target_postgres/__init__.py", line 373, in main
[2021-07-15 17:02:25,039] {subprocess.py:79} INFO - target-postgres-staging | persist_lines(config, singer_messages)
[2021-07-15 17:02:25,039] {subprocess.py:79} INFO - target-postgres-staging | File "/project/.meltano/loaders/target-postgres-staging/venv/lib/python3.6/site-packages/target_postgres/__init__.py", line 209, in persist_lines
[2021-07-15 17:02:25,039] {subprocess.py:79} INFO - target-postgres-staging | raise Exception("key_properties field is required")
[2021-07-15 17:02:25,039] {subprocess.py:79} INFO - target-postgres-staging | Exception: key_properties field is required
[2021-07-15 17:02:25,102] {subprocess.py:79} INFO - meltano | Loading failed (1): Exception: key_properties field is requireddouwe_maan
07/15/2021, 5:21 PMmeltano --log-level=debug elt … and look for the line that starts with tap-postgres-xxxxx (out) that writes the SCHEMA message that triggers that error in the target? I want to see if key_properties is actually missing/wrongrevanth_peddi
07/15/2021, 5:40 PMdouwe_maan
07/15/2021, 5:43 PMSCHEMA?revanth_peddi
07/15/2021, 5:46 PMrevanth_peddi
07/15/2021, 5:47 PMrevanth_peddi
07/15/2021, 5:48 PM{
"table_name": "XXXXX",
"stream": "XXXXX",
"metadata": [
{
"breadcrumb": [],
"metadata": {
"table-key-properties": [
"schemaid"
],douwe_maan
07/15/2021, 5:57 PMdouwe_maan
07/15/2021, 5:58 PMdouwe_maan
07/15/2021, 5:58 PMpip_url for tap-postgres at his PR branch, it should work as expected: https://github.com/transferwise/pipelinewise-tap-postgres/pull/102douwe_maan
07/15/2021, 5:58 PMrevanth_peddi
07/16/2021, 5:25 AMThere are no columns selected for stream public-XXXXX, , skipping itdouwe_maan
07/16/2021, 2:50 PMedward_smith
07/16/2021, 3:04 PMselected. So, two things I'd like to work through:
(1) The problem of overriding the primary key of a postgres table to that the target understands how to eliminate duplicates when inserting. Is this your use case?
(2) Why are you getting no selected columns when using my branch? The default behavior of pipelinewise-tap-postgres seems to be select all tables, regardless of the selected property in the catalog. My branch ensures that non-discoverable metadata is retained in the catalog after discovery. Can you double check your meltano.yml for me? Above you have:
select:
- public-xxxxx
But I think you need this to be:
select:
- public-xxxxx.*sumukh_ghodke
07/22/2021, 12:59 PMkey-properties metadata attribute containing a list, rather than a literal value. What do you think?edward_smith
07/22/2021, 3:01 PMtable-key-properties?sumukh_ghodke
07/22/2021, 3:26 PM[] , because its picking it up from the discovery metadata.edward_smith
07/22/2021, 3:31 PMmeltano.yml?sumukh_ghodke
07/22/2021, 3:36 PM--catalog argument like this meltano invoke tap-postgres --catalog catalog.json