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

add profiling option for duckdb #4

Merged
merged 2 commits into from
Oct 16, 2024
Merged
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
8 changes: 7 additions & 1 deletion src/driutils/io/duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,17 @@ class DuckDBS3Reader(DuckDBReader):
"""Concrete Implementation of a DuckDB reader for reading
data from an S3 endpoint"""

def __init__(self, auth_type: str, endpoint_url: Optional[str] = None, use_ssl: bool = True) -> None:
def __init__(
self, auth_type: str, endpoint_url: Optional[str] = None, use_ssl: bool = True, profiling: bool = False
) -> None:
"""Initializes

Args:
auth_type: The type of authentication to request. May
be one of ["auto", "sts", "custom_endpoint"]
endpoint_url: Custom s3 endpoint
use_ssl: Flag for using ssl (https connections).
profiling: Profile all duckdb queries. False by default.
"""

super().__init__()
Expand All @@ -76,6 +79,9 @@ def __init__(self, auth_type: str, endpoint_url: Optional[str] = None, use_ssl:

self._authenticate(auth_type, endpoint_url, use_ssl)

if profiling:
self._connection.execute("SET enable_profiling = query_tree;")

def _authenticate(self, method: str, endpoint_url: Optional[str] = None, use_ssl: bool = True) -> None:
"""Handles authentication selection

Expand Down