我按照说明安装sql magic。
https://github.com/catherinedevlin/ipython-sql
我收到以下错误
/anaconda/lib/python3.6/site-packages/IPython/config.py:13: ShimWarning: The `IPython.config` package has been deprecated since IPython 4.0. You should import from traitlets.config instead.
"You should import from traitlets.config instead.", ShimWarning)
/anaconda/lib/python3.6/site-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.
warn("IPython.utils.traitlets has moved to a top-level traitlets package.")
看起来它只是警告所以我继续尝试连接到Oracle DB版本是12.1.0.2.0
但仍然错误...
错误堆栈的结束:
/anaconda/lib/python3.6/site-packages/sqlalchemy/dialects/oracle/cx_oracle.py in <listcomp>(.0)
707
708 if hasattr(self.dbapi, 'version'):
--> 709 self.cx_oracle_ver = tuple([int(x) for x in
710 self.dbapi.version.split('.')])
711 else:
ValueError: invalid literal for int() with base 10: '0b2'
答案 0 :(得分:0)
我无法让sql魔法工作,但我找到了一个更简单的解决方案。
就这样做
import pandas as pd
print(con.version)
query = """select * from all_tab_columns"""
df_ora = pd.read_sql(query, con=con)