A graphql schema generator that uses the schema(s) of a database to generate a graphql schema.
- Oracle
- Oracle
- Read only
- AND filtering
A database and database user must already be created. What tables and database schema(s) are made available to graphQL depends on the select permissions of the used database user. For further refinement, one or more database schemas can be specified as an optional parameter.
Install db-to-graphql
using npm:
npm install --save db-to-graphql
Using this package:
var dbToGraphql = require('db-to-graphql');
const DB_CONNECTION = {
user: 'user',
password: 'pass',
connectionString: 'hostname:port/sid'
};
dbToGraphql.generateGraphQL(DB_CONNECTION, 'Oracle')
.then(function(generatedGraphql) {
let {root, schema} = generatedGraphql;
})
.catch((err) => {
console.log(err);
});
If you want to restrict which schemas are used for graphql and don't want to modify the permissions for the database user:
dbToGraphql.generateGraphQL(DB_CONNECTION, 'Oracle', ['SCHEMA1', 'SCHEMA2'])
- Oracle thin client
- Required for the oracledb package.
- graphql
- lodash
I encourage contribution especially with supporting more databases.
Changes are tracked as GitHub releases.
db-to-graphql is MIT-licensed.