如何在SQLAlchemy中使用外键约束创建ARRAY字段? [英] How to make ARRAY field with foreign key constraint in SQLAlchemy?

查看:142
本文介绍了如何在SQLAlchemy中使用外键约束创建ARRAY字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用ARRAY(Integer)类型创建列,其中每个整数是来自其他表的主键?如果不可能的话,如何实现与其他方法类似的表关系?

解决方案

从PostgreSQL 9.3开始,
http://blog.2ndquadrant.com/postgresql-9 -3-development-array-element-foreign-keys /
应该把数组转换成另一个表。


How to make column with ARRAY(Integer) type, where each integer is primary key from some other table? If it's impossible, how to achieve similar table relationships with other method?

解决方案

As of PostgreSQL 9.3, this is not implemented, see http://blog.2ndquadrant.com/postgresql-9-3-development-array-element-foreign-keys/ One should turn array into other table.

这篇关于如何在SQLAlchemy中使用外键约束创建ARRAY字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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