How to dynamically create and manage SQL-like tables, data, and relationships in a MongoDB-based system?

I'm building a web application where users can execute SQL queries on predefined tables for an exam module. The backend is in Django, and the database is MongoDB. I want to allow admins to dynamically:

  1. Create table schemas (table name, columns, data types, primary keys).

  2. Insert data into these tables.

  3. Define relationships between tables (e.g., foreign keys).

  4. Validate and execute SQL queries submitted by users based on the stored table schemas and relationships.

The goal is to minimize backend involvement by providing a user-friendly admin interface for managing tables and relationships.

I am looking for best practices or suggestions on:

  1. Efficiently storing table schemas and relationships in MongoDB.

  2. Dynamically executing and validating SQL-like queries based on these schemas.

  3. Simplifying the admin interface for managing tables and relationships in the frontend.

Any advice, code snippets, or recommended libraries/tools would be appreciated.

Вернуться на верх