Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuql does not play nicely with databases created by Django based backends #39

Open
tddpirate opened this issue Nov 5, 2022 · 0 comments

Comments

@tddpirate
Copy link

  1. 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 creating const tables in src/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)_');
  1. Django's table names are conventionally built as appname_tablename where appname 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant