Tuql does not play nicely with databases created by Django based backends
tddpirate opened this issue · 0 comments
tddpirate commented
- Currently, there is no mechanism to ignore Django's system tables if one does not want to allow GraphQL clients to access them. However, it is easy to add such a mechanism in ad-hoc way:
When creatingconst tables
insrc/builders/schema.js
, replace
const tables = rows.map(({
name
}) => name);
by
const tables = rows.map(({
name
}) => name).filter((name) => !filter_django_tables.test(name));
where filter_django_tables
is defined as:
const filter_django_tables = new RegExp('^(auth|django)_');
- Django's table names are conventionally built as
appname_tablename
whereappname
is the name of a Django application (a Django based backend consists of multiple applications). ManyToMany fields are implemented using intermediary join tables and the rules for building their names can be complicated due to table name length limitations by some database backends.
However, it is possible to assign custom names to tables if one has control over the Django project's software and database.