People 然后去做
People
People.objects.create(first='foo', last='bar', bio='test')
此模型使用 db_table='"people"."background"'
db_table='"people"."background"'
当我做测试的时候 People.objects.first() SELECT * from people.background
People.objects.first()
SELECT * from people.background
显然Django并没有正式支持schema。
我想出了一个解决方法,它连接到数据库并直接进行原始查询。基本上,
with connection().cursor as cursor: cursor.execute("""INSERT INTO bleh bleh bleh""") # assuming there's autocommit
编辑: