postgresql hasura-v2.xx给出了graphql-engine-1退出代码1在`hasura元数据轨道.`

sczxawaw  于 2023-10-18  发布在  PostgreSQL
关注(0)|答案(1)|浏览(128)

我正试着从莲浦开始。下面是我的docker-compose.yml文件:

version: "3.6"
services:
  postgres:
    image: postgres:15
    restart: always
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: postgrespassword
  graphql-engine:
    build:
      context: .
      dockerfile: DockerfileHasura
    # command: /bin/sh -c 'hasura metadata track --all-tables --all-relationships --schema public --endpoint http://graphql-engine:8080 && exec graphql-engine serve'
    command: /bin/sh -c 'exec graphql-engine serve'
    ports:
    - "8080:8080"
    restart: always
    volumes:
    - ./migrations:/hasura-migrations
    - ./metadata:/hasura-metadata
    - ./track_tables.sh:/track_tables.sh
    environment:
      HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
      PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console
      HASURA_GRAPHQL_DEV_MODE: "true"
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
      HASURA_GRAPHQL_CORS_DOMAIN: "*"
volumes:
  db_data:

DockerfileHasura中,我只是安装了Hasura的CLI,这样我就可以跟踪所有的表/视图:

FROM hasura/graphql-engine:v2.33.0

RUN curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash

我甚至不能用command: /bin/sh -c 'hasura metadata track --all-tables --all-relationships --schema public --endpoint http://graphql-engine:8080 && exec graphql-engine serve'运行系统,它给了我:graphql-engine-1 exited with code 1
然后我才知道,在v2.xx中,他们不再支持它。但我想把这个反射硬编码。这样我就不必打开网络控制台,编辑东西。参考:https://github.com/hasura/graphql-engine/issues/1418#issuecomment-894306630
现在我得到了"field 'product' not found in type: 'query_root'",。虽然他们是被创造出来的。
它在数据部分中没有显示任何视图/表:

有什么建议或变通办法吗?我想跟踪默认情况下在我的hasura系统中创建的每个表

9jyewag0

9jyewag01#

如果使用图形控制台不适合您的用例,我建议您编写一个简单的脚本:
1.从数据库中提取您想要跟踪的表的名称(例如,select ns.nspname as schema, cl.relname as table_name from pg_class cl join pg_namespace ns on cl.relnamespace = ns.oid where cl.relkind = 'r'
1.使用这些名称构建pg_track_tables API请求,您可以通过以下方式将其发送到hasura示例:curl

相关问题