graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Support for metadata.json in cli-migrations/v3/docker-entrypoint.sh

Open AndresPrez opened this issue 4 years ago • 7 comments

So the hasura cli-migrations/v3 script doesnt support loading metadata.json file, only yml files in a metadata directory.

This feature is quite useful because loading JSON metadata is much faster than YML files. Also running the hasura/graphql-engine:v2.5.0.cli-migrations-v3 container wont support loading JSON metadata on start up.

There was an attempt to do this back in the old days https://github.com/hasura/graphql-engine/pull/1968

AndresPrez avatar Apr 20 '22 22:04 AndresPrez

Hey, support for this was added in https://github.com/hasura/graphql-engine/commit/186baa7915a59b0ec2cb19de6a0494e60b767fa7. You can set a metadata_file variable to your config.yaml to point to a metadata json file (example). Unfortunately its not been documented well at the moment. Do let us know if this solves your issue

rikinsk avatar Apr 28 '22 09:04 rikinsk

@rikinsk yeah... doesn't look like it works. At least not in hasura/graphql-engine:v2.5.0.cli-migrations-v3, I tried that but I still get this same error that I get when not setting up any metadata:

{
    "path": "$.args.metadata",
    "error": "key \\"tables\\" not found",
    "code": "parse-failed"
}
More details Im running the docker image with the `HASURA_GRAPHQL_METADATA_DIR` set to the directory where I have my metadata.json and config.yaml.

config.yaml

version: 3
endpoint: http://host.docker.internal:8080
metadata_file: "metadata.json"

metadata.json

{
  "version": 3,
  "sources": [
    {
      "name": "postgres",
      "kind": "postgres",
      "configuration": {...},
      "tables": [...]
    }
  ]
}

AndresPrez avatar Apr 28 '22 16:04 AndresPrez

@AndresPrez So it seems like we don't seem to be supporting the metadata file option in the cli-migrations image at the moment. We'll use this issue to track this missing functionality and prioritize it.

rikinsk avatar May 03 '22 11:05 rikinsk

@AndresPrez So it seems like we don't seem to be supporting the metadata file option in the cli-migrations image at the moment. We'll use this issue to track this missing functionality and prioritize it.

Was tracking metadata as json ever addressed?

mbrevda avatar Apr 24 '23 12:04 mbrevda

I'd like to know this as well, as the JSON format is more portable between environments

geoffatsource avatar Sep 15 '23 00:09 geoffatsource

I'd love to have this functionality too!

banool avatar Sep 24 '23 18:09 banool

Want this too, would be nice

h45hc47 avatar Oct 21 '25 23:10 h45hc47