Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在SQLAlchemy上声明Postgres函数?_Python_Postgresql_Orm_Sqlalchemy_Flask Sqlalchemy - Fatal编程技术网

Python 如何在SQLAlchemy上声明Postgres函数?

Python 如何在SQLAlchemy上声明Postgres函数?,python,postgresql,orm,sqlalchemy,flask-sqlalchemy,Python,Postgresql,Orm,Sqlalchemy,Flask Sqlalchemy,我在使用炼金术,我的桌子/模型的结构如下 class TableName (db.Model): columnname = db.Column(db.String) 如何在那里插入Postgres自定义函数,以便SQLAlchemy了解它 我指的是像这样的函数 create function canonicalize (text) returns text as $$ select $1; $$ language sql;

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

class TableName (db.Model):
    columnname = db.Column(db.String)
如何在那里插入Postgres自定义函数,以便SQLAlchemy了解它

我指的是像这样的函数

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