Skip to content

Commit

Permalink
Merge pull request #4 from NERC-CEH/add_profiling
Browse files Browse the repository at this point in the history
add profiling option for duckdb
  • Loading branch information
nkshaw23 authored Oct 16, 2024
2 parents 02a884e + aed2267 commit 704340f
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 704340f

Please sign in to comment.