-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValidationError with Postgres JSON arrays #189
Comments
Can you create a reproducible example here like the DDL and DML that creates a sequence the meltanolabs tap-postgres and meltanolabs target-postgres doesn't like? This would be the most helpful here as it's not clear right now if this is a tap-postgres issue or target-postgres issue. To me it seems like the type of |
Hello @visch, create table "public"."test_meltano" (
id int not null,
packagings jsonb not null,
constraint "test_meltano_pkey" primary key (id)
);
INSERT INTO "public"."test_meltano" (id, "packagings") VALUES(1,'[{"type": "DEPOT_BAG", "other": "", "quantity": 1}]'::jsonb);
INSERT INTO "public"."test_meltano" (id, "packagings") VALUES(2,'[{"type": "BIG_BAG", "other": "", "quantity": 2},{"type": "DEPOT_BAG", "other": "", "quantity": 1}]'::jsonb);
INSERT INTO "public"."test_meltano" (id, "packagings") VALUES(3,'[]'::jsonb); The plugins:
extractors:
- name: tap-postgres
variant: meltanolabs
pip_url: git+https://github.com/MeltanoLabs/tap-postgres.git
select:
- public-test_meltano.*
loaders:
- name: target-postgres
variant: meltanolabs
pip_url: meltanolabs-target-postgres~=0.0.7 After a first run, the tap generate this {
"tap_stream_id": "public-test_meltano",
"table_name": "test_meltano",
"replication_method": "",
"key_properties": [
"id"
],
"schema": {
"properties": {
"id": {
"type": [
"integer"
]
},
"packagings": {
"properties": {},
"type": "object"
}
},
"type": "object",
"required": [
"id",
"packagings"
]
},
"is_view": false,
"stream": "public-test_meltano",
"metadata": [
{
"breadcrumb": [
"properties",
"id"
],
"metadata": {
"inclusion": "automatic",
"selected": true
}
},
{
"breadcrumb": [
"properties",
"packagings"
],
"metadata": {
"inclusion": "available",
"selected": true
}
},
{
"breadcrumb": [],
"metadata": {
"inclusion": "available",
"table-key-properties": [
"id"
],
"forced-replication-method": "",
"schema-name": "public",
"selected": true
}
}
],
"selected": true
} As you can see, I don't know the best way to handle this particular case, Transferwise's tap appends an |
This seems like a problem with tap-postgres as opposed to target-postgres. If the tap was accurately reporting the fact that the column can contain arrays and not just objects, everything would be operating smoothly. I've put in a PR in tap-postgres to fix this issue. |
Hello,
I have an issue when trying to load a table from Postgres to Postgres :
The issue is that JSON(b) columns in Postgres can contain JSON arrays which are converted into Python
list
inside the target-postgres plugin causing an inconsistency with the JSON schema type returned by the tap-postgres.I looked into the code of the transferwise's variant and found that for
array
andobject
JSON schema types it createsjsonb
Postgres columns : https://github.com/transferwise/pipelinewise-target-postgres/blob/bef5a2786afab3c1600e62a77b6d121625e7bc8e/target_postgres/db_sync.py#L44C5-L45C27The text was updated successfully, but these errors were encountered: