.read_sql_query works but .read_sql_table fails
See original GitHub issuePandas is very helpful and I have been using it heavily recently. However, I have run into an issue where this code works:
from sqlalchemy import *
import pandas as pd
orcl_connect_string = 'oracle+cx_oracle://system:oracle@192.168.56.101:1521/?service_name=orcl'
engine = create_engine(orcl_connect_string)
pd.read_sql_query('SELECT * FROM INT_PROP', engine)
but this code fails:
from sqlalchemy import *
import pandas as pd
orcl_connect_string = 'oracle+cx_oracle://system:oracle@192.168.56.101:1521/?service_name=orcl'
engine = create_engine(orcl_connect_string)
read_sql_table('INT_PROP', engine)
Error message I get back:
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 "/Users/me/Google Drive/Me Projects/Pycharm/auto-profiler/profile_pandas.py"
Traceback (most recent call last):
File "/Users/me/Google Drive/Me Projects/Pycharm/auto-profiler/profile_pandas.py", line 13, in <module>
df = pd.read_sql_table(table_name_str, engine)
File "/Library/Python/2.7/site-packages/pandas/io/sql.py", line 340, in read_sql_table
raise ValueError("Table %s not found" % table_name)
ValueError: Table INT_PROP not found
I can’t think of any other extenuating circumstances – it’s a table, not a view, the userid logging in has full rights to the table in question. I’ve also tried adding the schema name and I get the same error back.
Versions:
Mac OS X 10.11 El Capitan (recently upgraded but had the same issue on 10.10 Yosemite)
Oracle 12c
Python 2.7.6
SQLAlchemy 1.0.8
Pandas 0.16.2
Problem occurs whether running from within Pycharm CE or running at the terminal console with python.
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Query runs fine in SQL Server but Errors in trying to read into a ...
I toggle the SELECT * FROM #DeDupe; line in my code depending on whether I want to display the #DeDupe table or #TraceQtys...
Read more >Common SQL syntax errors and how to resolve them
In this article, we are going to describe some of the most common SQL syntax errors, and explains how you can resolve these...
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >SQL Errors: Five Common SQL Mistakes | LearnSQL.com
1. Misspelling Commands ... Each database version will tell you the exact word or phrase it doesn't understand, although the error message may...
Read more >Debugging SQL syntax errors - Metabase
Reading your SQL error message · Tell you the line or character position? · Include a table or column name? If the table...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you, @ChuliangXiao. Your solution worked for me.
I had the same issue. Now solved. Try table name in lower case. Thanks to Basel Issmail from SO.