Dynamic Table

62 views
Skip to first unread message

Helly Modi

unread,
May 24, 2023, 1:21:25 AM5/24/23
to Django users
I have to create dynamic table at runtime where user enters the details of table name,table column,table fields,constraints.take this input in backend and create table dynamically without creating schemas of tables as tables are created at runtime .first approach is that we will create one table where all the fields are mentioned where primary key,secondary key,unique,not niull and all the constraints are mentioned in horizontal column.now we have to create table 2 where user will select whild field id he want to select .suppose if user wants to create primary key then it will select field 1 in second table so it is refered from main table.and then table is created do you know how this works in django from backend side

Anh Nguyen

unread,
May 24, 2023, 1:36:23 AM5/24/23
to django...@googlegroups.com
Even your migrate works fine but you have to reload your runtime to apply new codebase to de-encode data. So go back and find another solution.

On Wed, 24 May 2023 at 12:22 Helly Modi <helly...@gmail.com> wrote:
I have to create dynamic table at runtime where user enters the details of table name,table column,table fields,constraints.take this input in backend and create table dynamically without creating schemas of tables as tables are created at runtime .first approach is that we will create one table where all the fields are mentioned where primary key,secondary key,unique,not niull and all the constraints are mentioned in horizontal column.now we have to create table 2 where user will select whild field id he want to select .suppose if user wants to create primary key then it will select field 1 in second table so it is refered from main table.and then table is created do you know how this works in django from backend side

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/24b3cec9-f614-4592-a1de-e69f2a71bc3fn%40googlegroups.com.

Helly Modi

unread,
May 24, 2023, 3:33:44 AM5/24/23
to Django users
worked on this option only .even tried dynamic django models but didn't work because of sustainable.if someone have the options or way to handle then please give

Anh Nguyen

unread,
May 24, 2023, 6:40:45 AM5/24/23
to django...@googlegroups.com
So what is your problems and why do we need a dynamic table?

Helly Modi

unread,
May 24, 2023, 6:47:14 AM5/24/23
to django...@googlegroups.com
we have to create this project where user can enter all details of table from frontend and table is created in backend so this idea was given where these and have to work on this idea only.see image for better understanding.

IMG20230524161124 (1).jpg

Jason

unread,
May 24, 2023, 7:45:10 AM5/24/23
to Django users
I hope you can understand the security implications of this and are knowledgeable on the places where you need to lock down access.  

Anh Nguyen

unread,
May 25, 2023, 3:21:57 AM5/25/23
to django...@googlegroups.com
Understood.
Your backend will control db. So assuming look like php-myadmin. Quite hard when orm in django doesn’t support it. You have to deal with raw sql.

Ryan Nowakowski

unread,
May 25, 2023, 10:50:28 AM5/25/23
to Helly Modi, Django users
Take a look at EAV. It's a method of storing a user defined schema. A Django project called wq has that as an option:

https://wq.io/guides/eav-vs-relational
Reply all
Reply to author
Forward
0 new messages