# 패키지 불러오기
#-*-coding:utf-8
import psycopg2
import pandas as pd
import csv
import sql
from sqlalchemy import create_engine
## 서버에 연결하는 방법
#아래 정보를 입력
user = 'xxx' # postgresql DB user ID
password = 'xxx' # password
host_product = 'IP address' # 서버 IP
dbname = 'xxxx' # DB Name
port='5432' # port number
product_connection_string = "dbname={dbname} user={user} host={host} password={password} port={port}".format(dbname=dbname,
user=user,
host=host_product,
password=password,
port=port)
try:
conn = psycopg2.connect(product_connection_string)
except:
print("I am unable to connect to the database")
cur = conn.cursor() ## conn, cur 커밋 날릴때 마다 해줘야함