This is a set of helper scripts used to convert a subset of the Spider Dataset SQL examples to hasura GraphQL examples.
The whole process involved manual verification of each step, and involved modifications to the databases and schemas. Since the end result requires manual intervention, and since the end result is already available, this is mostly for reference.
- install Postgres
- install pgloader
- have a root user on Postgres (
sudo createuser -s root
) - download the spider dataset
run with commanline arg with path to spider dataset ( or add the path to xcode schema)
ex swift SqlToPostgres path/to/dataset
used to download graphql schemas from hasura.
- run SqlToPostgres
- modify any schemas
run DownloadSchema modifying any options, schemas will be downloaded to root of project
ex swift DownloadSchemas
used to convert sql queries to graphql given the corresponding hasura schemas. This will create train and dev datasets.
- run DownloadSchemas
run SQLtoGraphQL passing arguments for the spider root folder and the path to save the new dataset
ex swift SQLtoGraphQL /path/to/spider/root /path/to/newGraphQLdataset
used to check queries from dataset against the real hasura endpoints.
- run SQLtoGraphQL
run VerifyQueryExecution passing an argument to the path of the dataset to verify
ex swift VerifyQueryExecution /path/to/train.json
used to save all postgres databases and hasura metadata
- run verify all postgres schemas and hasura metadata.
run SavePostgres passing an argument of the path to dump the databases to. ]
ex swift SavePostgres /path/to/dump/directory