import datetime
import numpy as np
import pandas as pd
import cx_Oracle as orcl
TARGET_HOST = "xx.xx.x.x"
PORT = "1521"
SERVICE_NAME = "***"
USERNAME = "***"
PASSWORD = "***"
## 接続識別子の作成
tns = orcl.makedsn(TARGET_HOST, PORT, service_name=SERVICE_NAME)
## DBへの接続
ora_con = orcl.connect(USERNAME, PASSWORD, tns)
SQL="""
select *
from table
"""
# データを取得してDataFrameへ変換
df = pd.read_sql(SQL, con=ora_con)
df.head()
## DBセッションの終了
ora_con.close()
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme