Closed
Description
Version Information
Server Version: v2.46.0 (docker image tag)
CLI Version (for CLI related issue): 2.48.1
Environment
Running OSS with Docker Compose locally
What is the current behaviour?
Running hasura metadata export
does not dump all information to yaml file structure. Specifically, native_queries and logical_models are missing.
What is the expected behaviour?
All metadata should be dumped when running hasura metadata export
.
How to reproduce the issue?
Environment configuration:
docker-compose.yml
services:
postgres:
image: postgres:17
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
image: hasura/graphql-engine:v2.46.0
init: true
ports:
- "0.0.0.0:8080:8080"
restart: always
volumes:
- ./metadata:/hasura-metadata
environment:
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/postgres
PG_DATABASE_URL: postgresql://postgres:postgrespassword@postgres:5432/postgres
HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
HASURA_GRAPHQL_DEV_MODE: "true"
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
HASURA_GRAPHQL_DISABLE_NATIVE_QUERY_VALIDATION: "true"
volumes:
db_data:
metadata.json
{
"resource_version": 32,
"metadata": {
"version": 3,
"sources": [
{
"name": "metadata",
"kind": "postgres",
"tables": [],
"native_queries": [
{
"arguments": {},
"code": "select 1",
"returns": "model",
"root_field_name": "query"
}
],
"logical_models": [
{
"fields": [],
"name": "model"
}
],
"configuration": {
"connection_info": {
"database_url": {
"from_env": "PG_DATABASE_URL"
},
"isolation_level": "read-committed",
"use_prepared_statements": false
}
}
}
]
}
}
- Run
docker compose up -d
with the provided compose file - Open web console and import the provided metadata.json file
- You should see one Native Query and one Logical Model in the metadata now
- Run
hasura metadata export -o yaml
, you should get the following output (native_queries/logical_models present as expected)
version: 3
sources:
- name: metadata
kind: postgres
tables: []
native_queries:
- arguments: {}
code: select 1
returns: model
root_field_name: query
logical_models:
- fields: []
name: model
configuration:
connection_info:
database_url:
from_env: PG_DATABASE_URL
isolation_level: read-committed
use_prepared_statements: false
- Run
hasura metadata export
- Search through the files that have now appeared at ./metadata. No native_queries or logical_models can be found.
Screenshots or Screencast
Please provide any traces or logs that could help here.
Any possible solutions/workarounds you're aware of?
Export the metadata as json or as a single yaml file rather than the full directory structure.
Keywords
metadata export