일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Tkinter
- Excel
- Python
- google apps script
- Google Excel
- Java
- gas
- SQL
- django
- Kotlin
- numpy
- 파이썬
- Apache
- GIT
- matplotlib
- array
- Redshift
- list
- dataframe
- Github
- string
- Google Spreadsheet
- hive
- Mac
- PySpark
- math
- PostgreSQL
- PANDAS
- c#
- Today
- Total
목록psycopg2 (3)
달나라 노트
psycopg2를 새로운 컴퓨터에서 설치하거나 또는 version이 업그레이드되거나 한다면 아래와 같은 Error가 발생할 때가 있습니다. Error: pg_config executable not found 여러 가지 상황이 있겠지만 위 에러는 주로 psycopg2 가 설치되기 전 또는 psycopg2가 업그레이드되면서 psycopg2에 필요한 다른 모듈들을 찾지 못하기 때문일 가능성이 큽니다. Python interpreter 사용 pip install postgresql Conda interpreter 사용 conda install postgresql 어떤 interpreter를 사용하고 있는지에 따라 위 2개의 명령어 중 하나를 terminal에 입력하여 postgresql 라이브러리를 설치해줍시다..
pyhive 라이브러리는 python에서 서버에 접근하여 Hive SQL query를 실행할 수 있도록 해줍니다. 이번에는 pyhive 라이브러리를 이용해서 Hive query를 돌리는 예시를 봐봅시다. 아래 코드가 가장 기본적인 pyhive 사용 예시입니다. from pyhive import hive import pandas as pd hive_con = hive.Connection( host='test_host', port=10000, username='test_user_id', password='test_user_password', database='default', auth='LDAP' ) cursor = hive_con.cursor() test_query = ''' select tt.id, tt..
import psycopg2 import pandas as pd def query_runner(query): dbname = 'sandbox' host = 'test_host' port = 1111 # port_number user_id = 'redshift_user_id' password = 'redshift_user_name' connection_info = "dbname='{}' host='{}' port={} user='{}' password='{}'".format(dbname, host, port, user_id, password) connection = psycopg2.connect(connection_info) cursor = connection.cursor() cursor.execute(q..