Skip to content
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

Need Support for Joining Postgres tables using arrays of IDs #519

Open
kundankumarcasio opened this issue Jan 8, 2024 · 1 comment
Open

Comments

@kundankumarcasio
Copy link

PGSync version: latest

Postgres version: 15.2

Elasticsearch/OpenSearch version: 7.17.13

Redis version: 7.2

Python version: 3.8

Problem Description:
I want to index children with given condition
[
{
"database": "databaseName",
"index": "indexName",
"nodes": {
"table": "parentTable",
"columns": [],
"children": [
{
"table": "childTable",
"columns": [],
"relationship": {
"variant": "object",
"type": "one_to_many",
"in": { //need help here
"child": [
"id"
],
"parent": [
"childTable_ids"
],

}
}
}
]
}
}
]

Equivalent SQL Query:
select * from parentTable join childTable where childTable.id=ANY(parentTable.childTable_ids)

table Structure

Parent Table
id[serial],childTable_ids[serial Array],...
1,{1,2,3,4},....

Child Table
id[serial],other cols..
1,data1,data2..
2,....,
3,....
4,.....
5,.....

Error Message (if any):

@jvanderen1
Copy link

PGSync is probably not a good use case for this. I would reconsider either how you should index your cluster or change your Elasticsearch queries to search on the correct conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants