-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: AttributeError: 'function' object has no attribute 'currentframe' #48733
Comments
Hi, thanks for your report. This is not considered public, so there are not guarantees that the class is stable from one release to another
|
Thanks for the report - this is indeed a bug as I think something like --- a/pandas/io/sql.py
+++ b/pandas/io/sql.py
@@ -1645,10 +1645,10 @@ class SQLDatabase(PandasSQL):
if not name.isdigit() and not name.islower():
# check for potentially case sensitivity issues (GH7815)
# Only check when name is not a number and name is not lower case
- from sqlalchemy import inspect
+ sqlalchemy = import_optional_dependency("sqlalchemy", errors="ignore")
with self.connectable.connect() as conn:
- insp = inspect(conn)
+ insp = sqlalchemy.inspect(conn) should fix it |
Labelling as 1.5.1 then, if you think this is a minimal fix. Any idea if this breaks something internally? |
I think it should only cause issues in cases where the code would've thrown a warning |
Indeed, but so that's still a breaking change. |
@huka81 for context, are you actually using |
I used SQLDatabase just to reproduce and demonstrate the issue, actual stack trace is:
and this is caused by NDFrame.to_sql() method |
@huka81 thanks, that good! |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
Fails on invoking SQLDatabase.check_case_sensitive with table name, which does not exists in database with error:
Expected Behavior
Same code was passing till version 1.4.4
Installed Versions
INSTALLED VERSIONS
commit : 87cfe4e
python : 3.9.13.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19044
machine : AMD64
processor : Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : Polish_Poland.1250
pandas : 1.5.0
numpy : 1.21.2
pytz : 2021.3
dateutil : 2.8.2
setuptools : 58.1.0
pip : 22.0.4
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : 1.4.41
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
The text was updated successfully, but these errors were encountered: