Rezaul Karim Shaon
Rezaul Karim Shaon

Reputation: 145

Generate table using raw SQL query and want to use those tables as ORM in Django

table_title = 'transaction_' + username
with connection.cursor() as cursor:
    sql = 'CREATE TABLE ' + table_title + '(id uuid NOT NULL,
    sql += 'amount numeric(10,2) NOT NULL,
    sql += 'CONSTRAINT transaction_pkey' + username + ' PRIMARY KEY (id),'
    cursor.execute(sql)

I have create table using this code. Now what I want:

Is it possible? If yes, then how?

Upvotes: 1

Views: 788

Answers (1)

Rezaul Karim Shaon
Rezaul Karim Shaon

Reputation: 145

There is no way use ORM while you execute raw SQL. If you want to an admin panel you have to develop your own custom admin panel.

Upvotes: 2

Related Questions