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

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

问题描述

如何制作 ARRAY(Integer) 类型的列,其中每个整数都是其他表的主键?如果不可能,如何用其他方法实现相似的表关系?

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?

推荐答案

从 PostgreSQL 9.3 开始,这个没有实现,见http://blog.2ndquadrant.com/postgresql-9-3-development-array-element-foreign-keys/应该将数组转换为其他表.

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天全站免登陆