gpt4 book ai didi

postgresql - SQLAlchemy postgresql.ARRAY 大小

转载 作者:行者123 更新时间:2023-11-29 12:34:13 25 4
gpt4 key购买 nike

如何在 SQLAlchemy 中添加 postgres 数组的大小?

像 SQL 类型 Integer[2]:

column = Column(postgresql.ARRAY(Integer), size=2)

最佳答案

在 PostgreSQL 中,您只需将列定义为某种基本类型的 ARRAY,例如 integer[]。您可以在类型声明中包含维度,例如 integer[3][3],但它们没有效果,因为它们不是强制性的。我引用 manual here :

However, the current implementation ignores any supplied array size limits, i.e., the behavior is the same as for arrays of unspecified length.

关于postgresql - SQLAlchemy postgresql.ARRAY 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8472710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com