小编lif*_*fpy的帖子

Python 代码不会在数据库上创建表,但能够查询结果 postgres

我的用例是在 postgres 数据库中编写一个临时表并从中获取记录并插入到不同的表中。

我使用的代码是:

import psycopg2
import sys
import pprint

from __future__ import print_function
from os.path import join,dirname,abspath
import xlrd
import os.path

newlist = []
itemidlist = []

def main():

    conn_string = "host='prod-dump.cvv9i14mrv4k.us-east-1.rds.amazonaws.com' dbname='ebdb' user='ebroot' password='*********'"
    # print the connection string we will use to connect
    # print "Connecting to database" % (conn_string)

    # get a connection, if a connect cannot be made an exception will be raised here
    conn = psycopg2.connect(conn_string)

    # conn.cursor will return a cursor object, you …
Run Code Online (Sandbox Code Playgroud)

python database postgresql create-table

2
推荐指数
1
解决办法
1350
查看次数

标签 统计

create-table ×1

database ×1

postgresql ×1

python ×1