@@ -182,7 +182,7 @@ def _wrap_result(
182
182
return frame
183
183
184
184
185
- def execute (sql , con , cur = None , params = None ):
185
+ def execute (sql , con , params = None ):
186
186
"""
187
187
Execute the given SQL query using the provided connection object.
188
188
@@ -194,18 +194,14 @@ def execute(sql, con, cur=None, params=None):
194
194
Using SQLAlchemy makes it possible to use any DB supported by the
195
195
library.
196
196
If a DBAPI2 object, only sqlite3 is supported.
197
- cur : deprecated, cursor is obtained from connection, default: None
198
197
params : list or tuple, optional, default: None
199
198
List of parameters to pass to execute method.
200
199
201
200
Returns
202
201
-------
203
202
Results Iterable
204
203
"""
205
- if cur is None :
206
- pandas_sql = pandasSQL_builder (con )
207
- else :
208
- pandas_sql = pandasSQL_builder (cur , is_cursor = True )
204
+ pandas_sql = pandasSQL_builder (con )
209
205
args = _convert_params (sql , params )
210
206
return pandas_sql .execute (* args )
211
207
@@ -774,22 +770,18 @@ def _engine_builder(con):
774
770
return con
775
771
776
772
777
- def pandasSQL_builder (
778
- con , schema : str | None = None , meta = None , is_cursor : bool = False
779
- ):
773
+ def pandasSQL_builder (con , schema : str | None = None , meta = None ):
780
774
"""
781
775
Convenience function to return the correct PandasSQL subclass based on the
782
776
provided parameters.
783
777
"""
784
- # When support for DBAPI connections is removed,
785
- # is_cursor should not be necessary.
786
778
con = _engine_builder (con )
787
779
if _is_sqlalchemy_connectable (con ):
788
780
return SQLDatabase (con , schema = schema , meta = meta )
789
781
elif isinstance (con , str ):
790
782
raise ImportError ("Using URI string without sqlalchemy installed." )
791
783
else :
792
- return SQLiteDatabase (con , is_cursor = is_cursor )
784
+ return SQLiteDatabase (con )
793
785
794
786
795
787
class SQLTable (PandasObject ):
@@ -2031,8 +2023,7 @@ class SQLiteDatabase(PandasSQL):
2031
2023
2032
2024
"""
2033
2025
2034
- def __init__ (self , con , is_cursor : bool = False ):
2035
- self .is_cursor = is_cursor
2026
+ def __init__ (self , con ):
2036
2027
self .con = con
2037
2028
2038
2029
@contextmanager
@@ -2048,10 +2039,7 @@ def run_transaction(self):
2048
2039
cur .close ()
2049
2040
2050
2041
def execute (self , * args , ** kwargs ):
2051
- if self .is_cursor :
2052
- cur = self .con
2053
- else :
2054
- cur = self .con .cursor ()
2042
+ cur = self .con .cursor ()
2055
2043
try :
2056
2044
cur .execute (* args , ** kwargs )
2057
2045
return cur
0 commit comments