Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typing: add stubs for connectorx.so #606

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Loading