SQLAlchemy connection.execute COMMENT ON Postgres无法正常工作

时间:2017-04-28 18:39:27

标签: python postgresql sqlalchemy

我有一个本地postgres数据库。我正在尝试使用connection.execute运行简单的comment on命令。例如,

import sqlalchemy as sa
db_url = DB_URL
db_engine = sa.create_engine(db_url)
conn = db_engine.connect()

conn.execute('create schema test')
conn.execute('create table test.testing as (select 1 as value)')

conn.execute("comment on table test.testing is 'this is my table'")

这实际上会在我的本地数据库中创建一个表test.testing,但是当我运行以下内容时:

select * 
from pg_description
join pg_class
on pg_description.objoid = pg_class.oid
join pg_namespace
on pg_class.relnamespace = pg_namespace.oid
where pg_namespace.nspname = 'test'
and pg_class.relname = 'testing' 

实际上没有返回任何行。

0 个答案:

没有答案