如何在SQLAlchemy上声明Postgres函数?

2024-04-19 04:41:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的是炼金术,我的桌子/模型结构如下

class TableName (db.Model):
    columnname = db.Column(db.String)

如何在那里插入Postgres自定义函数以便SQLAlchemy知道它?你知道吗

我是说像这样的函数

create function canonicalize (text) returns text as $$
  select $1;
$$ language sql;

Tags: 函数text模型dbstringmodelsqlalchemycolumn