如何在Django中使用模式? [英] How to use schemas in Django?

查看:164
本文介绍了如何在Django中使用模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用django使用postgreSQL模式,我该怎么做?

解决方案

我一直在使用:

  db_table ='schema。tablename'

在过去没有意识到只有工作为只读操作。当您尝试添加新记录时,会失败,因为序列将是schema.tablename_column_id_seq。

  db_table = 'schema\.\tablename'

到目前为止工作。谢谢。


I whould like to use postgreSQL schemas with django, how can I do this?

解决方案

I've been using:

db_table = '"schema"."tablename"'

in the past without realising that only work for read-only operation. When you try to add new record it would fail because the sequence would be something like "schema.tablename"_column_id_seq.

db_table = 'schema\".\"tablename'

does work so far. Thanks.

这篇关于如何在Django中使用模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆