33from __future__ import annotations
44from collections .abc import Generator , Iterable , Iterator , Sequence
55from typing import Any , Callable , Final , Union
6+ from typing_extensions import LiteralString
67
78
89# SQLSetConnectAttr attributes
@@ -484,7 +485,7 @@ class Connection:
484485 """
485486 ...
486487
487- def execute (self , sql : str , * params : Any ) -> Cursor :
488+ def execute (self , sql : LiteralString , * params : Any ) -> Cursor :
488489 """A convenience function for running queries directly from a Connection object.
489490 Creates a new cursor, runs the SQL query, and returns the new cursor.
490491
@@ -619,7 +620,7 @@ class Cursor:
619620 """Not supported."""
620621 ...
621622
622- def execute (self , sql : str , * params : Any ) -> Cursor :
623+ def execute (self , sql : LiteralString , * params : Any ) -> Cursor :
623624 """Run a SQL query and return the cursor. If the query returns multiple result
624625 sets (generally because the SQL query contained multiple statements), retrieve
625626 them by making multiple calls to the nextset() function.
@@ -633,7 +634,7 @@ class Cursor:
633634 """
634635 ...
635636
636- def executemany (self , sql : str , params : Union [Sequence , Iterator , Generator ], / ) -> None :
637+ def executemany (self , sql : LiteralString , params : Union [Sequence , Iterator , Generator ], / ) -> None :
637638 """Run the SQL query against an iterable of parameters. The behavior of this
638639 function depends heavily on the setting of the fast_executemany cursor property.
639640 See the Wiki for details.
0 commit comments