remove pokemon_v2_ prefix from GraphQL keys
I'd like to have a cleaner way to build GraphQL queries. Currently all keys are prefixed with a pokemon_v2_ string. This is because Hasura tracks postgres tables and our tables have that prefix.
It would be cool to strip it away so to be able to build cleaner queries like the one below:
query samplePokeAPIquery {
pokemonspecies(
where: {generation: {name: {_eq: "generation-iii"}}}
order_by: {id: asc}
) {
name
id
}
generation {
name
pokemonspecies_aggregate {
aggregate {
count
}
}
}
}
instead of the currently working:
query samplePokeAPIquery {
gen3_species: pokemon_v2_pokemonspecies(
where: {pokemon_v2_generation: {name: {_eq: "generation-iii"}}}
order_by: {id: asc}
) {
name
id
}
generations: pokemon_v2_generation {
name
pokemon_species: pokemon_v2_pokemonspecies_aggregate {
aggregate {
count
}
}
}
}
@PraaneshSelvaraj or you could investigate this
Hmm this is interesting, I guess Hasura has no way to set an alias for tables?
Tried in past but with no luck, maybe with newer version they added a way to achieve it
Hey, we can set custom names for each table in Hasura. BUt, if we do this directly in the console, we have to manually rename them with every deployment to both our dev and production environments.
To avoid manually renaming them, we can maintain the Hasura metadata within our git repo. This ensures that the custom names are automatically loaded saving us from manual configuration every time we spin up a hasura server.
Hey, Actually I found that configuration files under the graphql directory. I think we can setup custom names over here for each table. Maybe I will try that.