janis_puris
06/25/2023, 3:55 PMtarget-postgres
by MeltanoLabs is broken for taps that use non-lowercase stream names.
For example a stream from tap named MY_ORACLE_SCHEMA-MY_TABLE
and with target's
default_target_schema: source # created beforehand
the target will create a table <http://source.MY|source.MY>_TABLE
Then immediately will fail because it is not able to find it anymore as it expects <http://source.my|source.my>_table
present in DB instead.
There are no currently open Github issues on https://github.com/MeltanoLabs/target-postgres/
I did find a reference to something similar in Slack thread, which seems to be merged in master and is part of v0.0.5 (released back in April).
Logs and more info in thread
edit: Is not reproducible with transferwise targetjanis_puris
06/25/2023, 3:55 PMjanis_puris
06/25/2023, 3:58 PMversion: 1
default_environment: dev
project_id: b1d562d0-d114-42a7-bad1-957891a7285b
environments:
- name: dev
- name: uat
- name: prod
plugins:
extractors:
- name: tap-oracle
pip_url: git+<https://github.com/christianelliott/pipelinewise-tap-oracle.git>
config:
filter_schemas: MY_ORACLE_SCHEMA
default_replication_method: FULL_TABLE
port: redacted
host: redacted
user: redacted
service_name: redacted
use_ora_rowscn: true
add_metadata_columns: true
select:
- MY_ORACLE_SCHEMA-MY_TABLE.*
loaders:
- name: target-postgres
variant: meltanolabs
pip_url: git+<https://github.com/MeltanoLabs/target-postgres.git>
config:
host: localhost
port: 5432
dbname: postgres
user: redacted
default_target_schema: source
add_record_metadata: false
hard_delete: false
batch_size_rows: 100000
user
06/26/2023, 4:15 PMmeltano install loader target-postgres --clean
. cc @visch any ideas? I was dealing with some of this recently in target-snowflake. I'm not seeing where this rename logic is actually being called but it looks like https://github.com/meltano/sdk/blob/c6a893372d036a99da81ee9131b8b6e17f50e670/singer_sdk/connectors/sql.py#L1001 is where the invalid sql is generated.janis_puris
06/26/2023, 4:18 PMmeltano add loader target-postgres --variant=meltanolabs
I can spin up a new one and try to reproduce it, if needed.
Is there some way to check the installed plugin version? thinkspinvisch
06/26/2023, 4:22 PM17:38:58 name=target_postgres level=INFO message=Versioning column: ALTER TABLE source."my_table" RENAME COLUMN "redacted" TO "redacted_20230625_1738" cmd_type=elb consumer=True name=target-postgres producer=False stdio=stderr string_id=target-postgres
Yeah I didn't migrate the Alter Table logic... I'll add a test and get this fixed. Give me 15 minutesvisch
06/26/2023, 4:24 PMvisch
06/26/2023, 4:41 PM2023-06-25T15:38:58.965794Z [info ] File "/radacted/project/.meltano/loaders/target-postgres/venv/lib/python3.10/site-packages/target_postgres/db_sync.py", line 311, in query cmd_type=elb consumer=True name=target-postgres producer=False stdio=stderr string_id=target-postgres
2023-06-25T15:38:58.965881Z [info ]
db_sync.py
isn't a file in the meltano labs variant.
Maybe you need to re-run a fresh install ie meltano install --clean
visch
06/26/2023, 4:41 PMvisch
06/26/2023, 4:44 PMjanis_puris
06/26/2023, 4:48 PMplugins:
extractors:
- name: tap-oracle
pip_url: git+<https://github.com/christianelliott/pipelinewise-tap-oracle.git>
...
loaders:
- name: target-postgres
variant: meltanolabs
pip_url: git+<https://github.com/MeltanoLabs/target-postgres.git>
config:
...
then
meltano install --clean
meltano run tap-oracle target-postgres
visch
06/26/2023, 4:49 PMvisch
06/26/2023, 4:49 PMjanis_puris
06/26/2023, 4:51 PMvisch
06/26/2023, 4:51 PMjanis_puris
06/26/2023, 4:57 PM❯ meltano run tap-oracle target-postgres
the only thing I've redacted are the dsn
args, select query and the local fs path to meltano project.
On PostrgeSQL running on localhost I see it has recreated the table from scratch (I had removed it prior to running this) and it is named CHANNEL
while it expects to see channel
edit: error
2023-06-26T16:54:26.764388Z [info ] sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "source__icx.channel" does not exist cmd_type=elb consumer=True name=target-postgres producer=False stdio=stderr string_id=target-postgres
janis_puris
06/26/2023, 4:59 PMvisch
06/26/2023, 5:00 PMjanis_puris
06/26/2023, 5:01 PMSELECT
name
FROM information_schema.tables
WHERE
table_schema = 'source__icx';
gets me
[
{
"table_name": "CHANNEL"
}
]
visch
06/26/2023, 7:17 PMvisch
06/26/2023, 7:17 PM