postgresql创建表名和schema都是参数

前端之家收集整理的这篇文章主要介绍了postgresql创建表名和schema都是参数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

前提是已经创建连接了

from psycopg2.extensions import AsIs
cur = conn.cursor()
schame='schemaname'
table = 'tablename'
cur.execute("create table %s.%s(name text)",(AsIs(schema),AsIs(table)));
conn.commit()

猜你在找的Postgre SQL相关文章