I am using django and postgresql db to develop my project, the db has 3 schemas. And I am writing raw quires using connection string to fetch data and insert data into tables.

Example:

from django.db import connection 
    query = "select * from schema1.records" 
    cursor = connection.cursor()
    cursor.execute(query)
    output = cursor.fetchall()

Like way I am using in my all views.

I wanted to write test cases to my views, so i need to generate fixtures to test my views, how to I generate fixtures for schemas and tables. Please help.

Note: I did not write any models i just used raw queries in my whole project.

link|improve this question
As a sidenote, schema support is actively being worked on: code.djangoproject.com/ticket/6148 – Danilo Bargen Apr 4 at 12:35
are you getting my question, if not please let me know – prashanth Apr 9 at 6:17
feedback

1 Answer

Run:

manage.py dumpdata help

This will show how to use loaddata to generate fixtures.

link|improve this answer
loaddata can insert the data into dabase if i had json file right. – prashanth Apr 4 at 12:05
my bad, dumpdata is the command, answer updated – jpic Apr 4 at 14:40
but i don't have the models for my tables, because i am using existed database and tables. – prashanth Apr 5 at 13:20
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.