Skip to content

Commit

Permalink
Accept TextClause type as a query param
Browse files Browse the repository at this point in the history
  • Loading branch information
wakabame committed Oct 25, 2024
1 parent 4e87f01 commit edd7e1d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions py-polars/polars/io/database/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
except ImportError:
Selectable: TypeAlias = Any # type: ignore[no-redef]

from sqlalchemy.sql.elements import TextClause


@overload
def read_database(
query: str | Selectable,
query: str | TextClause | Selectable,
connection: ConnectionOrCursor | str,
*,
iter_batches: Literal[False] = ...,
Expand All @@ -41,7 +43,7 @@ def read_database(

@overload
def read_database(
query: str | Selectable,
query: str | TextClause | Selectable,
connection: ConnectionOrCursor | str,
*,
iter_batches: Literal[True],
Expand All @@ -54,7 +56,7 @@ def read_database(

@overload
def read_database(
query: str | Selectable,
query: str | TextClause | Selectable,
connection: ConnectionOrCursor | str,
*,
iter_batches: bool,
Expand All @@ -66,7 +68,7 @@ def read_database(


def read_database(
query: str | Selectable,
query: str | TextClause | Selectable,
connection: ConnectionOrCursor | str,
*,
iter_batches: bool = False,
Expand Down

0 comments on commit edd7e1d

Please sign in to comment.