question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.read_sql_query works but .read_sql_table fails

See original GitHub issue

Pandas 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:closed
  • Created 8 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
thiagodmacommented, Jul 8, 2020

Thank you, @ChuliangXiao. Your solution worked for me.

1reaction
ChuliangXiaocommented, Jun 17, 2020

I had the same issue. Now solved. Try table name in lower case. Thanks to Basel Issmail from SO.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found