Skip to content

BUG: AttributeError: 'function' object has no attribute 'currentframe' #48733

Closed
@huka81

Description

@huka81

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

import pandas.io.sql
import sqlalchemy

dbEngine=sqlalchemy.create_engine(f'sqlite:///dummy.db')

db = pandas.io.sql.SQLDatabase(engine=dbEngine)
db.check_case_sensitive("TABLE1", "") # passing
print("check 1 for existing table passed")
db.check_case_sensitive("TABLE2", "") # failing
print("check 2 for non-existing table passed")

Issue Description

Fails on invoking SQLDatabase.check_case_sensitive with table name, which does not exists in database with error:

Traceback (most recent call last):
File "C:\Users\artur\PycharmProjects\Ex_Files_Python_EssT\Exercise Files\Chap02\pandas_debug.py", line 15, in
db.check_case_sensitive("TABLE2", "")
File "C:\Users\artur\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pandas\io\sql.py", line 1664, in check_case_sensitive
stacklevel=find_stack_level(inspect.currentframe()),
AttributeError: 'function' object has no attribute 'currentframe'

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO SQLto_sql, read_sql, read_sql_queryRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions