Skip to content

Commit

Permalink
Merge pull request #606 from zen-xu/connectorx-stub
Browse files Browse the repository at this point in the history
typing: add stubs for connectorx.so
  • Loading branch information
wangxiaoying authored Apr 17, 2024
2 parents fa3164c + b38f78e commit 2ae2110
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions connectorx-python/connectorx/connectorx.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from __future__ import annotations

from typing import overload, Literal, Any, TypeAlias
import pandas as pd

_ArrowArrayPtr: TypeAlias = int
_ArrowSchemaPtr: TypeAlias = int
_Column: TypeAlias = str

@overload
def read_sql(
conn: str,
return_type: Literal["pandas"],
protocol: str | None,
queries: list[str] | None,
partition_query: dict[str, Any] | None,
) -> pd.DataFrame: ...
@overload
def read_sql(
conn: str,
return_type: Literal["arrow", "arrow2"],
protocol: str | None,
queries: list[str] | None,
partition_query: dict[str, Any] | None,
) -> tuple[list[_Column], list[list[tuple[_ArrowArrayPtr, _ArrowSchemaPtr]]]]: ...
def partition_sql(conn: str, partition_query: dict[str, Any]) -> list[str]: ...
def read_sql2(
sql: str, db_map: dict[str, str]
) -> tuple[list[_Column], list[list[tuple[_ArrowArrayPtr, _ArrowSchemaPtr]]]]: ...
def get_meta(
conn: str,
protocol: Literal["csv", "binary", "cursor", "simple", "text"] | None,
query: str,
) -> dict[str, Any]: ...
Empty file.

0 comments on commit 2ae2110

Please sign in to comment.