Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

Commit

Permalink
add experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Jan 28, 2024
1 parent e879425 commit b6b1847
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion dagster_polars/io_managers/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

import polars as pl
from dagster import InputContext, MetadataValue, OutputContext
from dagster._annotations import experimental
from dagster._core.storage.db_io_manager import DbTypeHandler, TableSlice

from dagster_polars.io_managers.utils import get_polars_metadata

try:
from dagster_gcp.bigquery.io_manager import BigQueryClient, BigQueryIOManager
from google.cloud import bigquery as bigquery
except ImportError as e:
raise ImportError("Install 'dagster-polars[gcp]' to use BigQuery functionality") from e
from dagster_polars.io_managers.utils import get_polars_metadata


@experimental
class PolarsBigQueryTypeHandler(DbTypeHandler[pl.DataFrame]):
"""Plugin for the BigQuery I/O Manager that can store and load Polars DataFrames as BigQuery tables.
Expand Down
5 changes: 3 additions & 2 deletions dagster_polars/io_managers/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import dagster._check as check
import polars as pl
from dagster import InputContext, MetadataValue, OutputContext
from dagster._annotations import experimental
from dagster._core.storage.upath_io_manager import is_dict_type

from dagster_polars.io_managers.base import BasePolarsUPathIOManager
from dagster_polars.types import DataFrameWithMetadata, LazyFrameWithMetadata, StorageMetadata

try:
Expand All @@ -16,8 +18,6 @@
except ImportError as e:
raise ImportError("Install 'dagster-polars[deltalake]' to use DeltaLake functionality") from e

from dagster_polars.io_managers.base import BasePolarsUPathIOManager

if TYPE_CHECKING:
from upath import UPath

Expand All @@ -34,6 +34,7 @@ class DeltaWriteMode(str, Enum):
ignore = "ignore"


@experimental
class PolarsDeltaIOManager(BasePolarsUPathIOManager):
"""Implements writing and reading DeltaLake tables.
Expand Down
2 changes: 2 additions & 0 deletions dagster_polars/io_managers/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pyarrow.dataset as ds
import pyarrow.parquet as pq
from dagster import InputContext, OutputContext
from dagster._annotations import experimental
from fsspec.implementations.local import LocalFileSystem
from packaging.version import Version
from pyarrow import Table
Expand Down Expand Up @@ -74,6 +75,7 @@ def scan_parquet(path: "UPath", context: InputContext) -> pl.LazyFrame:
return pl.scan_parquet(str(path), storage_options=storage_options, **kwargs) # type: ignore


@experimental
class PolarsParquetIOManager(BasePolarsUPathIOManager):
"""Implements reading and writing Polars DataFrames in Apache Parquet format.
Expand Down

0 comments on commit b6b1847

Please sign in to comment.