toluaina / pgsync

Postgres to Elasticsearch/OpenSearch sync
https://pgsync.com
MIT License
1.16k stars 181 forks source link

Relationship not present on #348

Open askatmaster opened 1 year ago

askatmaster commented 1 year ago

PGSync version: 2.3.2 Postgres version: docker image postgis/postgis:latest Elasticsearch version: 8.4.3 Redis version: docker image redis:alpine Python version: docker image python:3.10.6 Problem Description: I'm trying to get the default book and author tables to sync via pgsync in doker-compose. Here is my docker compose: image

HERE IS MY schema.json image

HERE IS MY PgsyncDockerfile image

HERE IS MY entrypoint.sh image

HERE IS MY database image

All services except pgsync start and work correctly. Please help, I can't solve this problem

Error Message (if any):

wait-for-it: waiting 60 seconds for database:5432
wait-for-it: database:5432 is available after 0 seconds
wait-for-it: waiting 60 seconds for redis:6379
wait-for-it: redis:6379 is available after 0 seconds
wait-for-it: waiting 60 seconds for elasticsearch:9200
wait-for-it: elasticsearch:9200 is available after 0 seconds
/usr/local/lib/python3.10/site-packages/pgsync/base.py:170: SAWarning: Did not recognize type 'geometry' of column 'location'
  metadata.reflect(self.engine, views=True)
Traceback (most recent call last):
  File "/usr/local/bin/bootstrap", line 70, in <module>
    main()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/bin/bootstrap", line 59, in main
    sync: Sync = Sync(
  File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 107, in __init__
    self.validate(repl_slots=repl_slots)
  File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 186, in validate
    self.root: Node = self.tree.build(self.nodes)
  File "/usr/local/lib/python3.10/site-packages/pgsync/node.py", line 295, in build
    node.add_child(self.build(child))
  File "/usr/local/lib/python3.10/site-packages/pgsync/node.py", line 224, in add_child
    raise RelationshipError(
pgsync.exc.RelationshipError: 'Relationship not present on "public.author"'
/usr/local/lib/python3.10/site-packages/pgsync/base.py:170: SAWarning: Did not recognize type 'geometry' of column 'location'
  metadata.reflect(self.engine, views=True)
Traceback (most recent call last):
  File "/usr/local/bin/pgsync", line 7, in <module>
    sync.main()
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 1410, in main
    sync: Sync = Sync(document, verbose=verbose, **kwargs)
  File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 107, in __init__
    self.validate(repl_slots=repl_slots)
  File "/usr/local/lib/python3.10/site-packages/pgsync/sync.py", line 186, in validate
    self.root: Node = self.tree.build(self.nodes)
  File "/usr/local/lib/python3.10/site-packages/pgsync/node.py", line 295, in build
    node.add_child(self.build(child))
  File "/usr/local/lib/python3.10/site-packages/pgsync/node.py", line 224, in add_child
 0:00:00.244743 (0.24 sec)
    raise RelationshipError(
pgsync.exc.RelationshipError: 'Relationship not present on "public.author"'
toluaina commented 1 year ago
askatmaster commented 1 year ago

The screenshots provided show which tables I create with which links. Tables have relationships. Why is the chart incomplete? please give me the complete diagram.

imcyee commented 1 year ago

I think what he meant was to add relationship tag in your schema.json. Here is the doc