We are happy to announce the release of pyexasol 1.2.0 with support to import from & export to local parquet file(s).
# As parquet usage is linked to an optional import, make sure to use the equivalent
# of `pip install pyexasol[pyarrow]` in your dependency management tool beforehand.
import pyexasol
from pathlib import Path
# create the connection with compression activated
C = pyexasol.connect(dsn='<host:port>', user='<user>', password='<password>', compression=True)
# list[Path]: list of specific local parquet files to load
C.import_from_parquet(source=[Path("local_path/test.parquet")], table="users")
# Path: can be either a local file or directory. If it's a local directory,
# all files matching this pattern `*.parquet` will be processed.
C.import_from_parquet(source=Path("local_path/test.parquet"), table="users")
# string: representing a local filepath which already contains a glob pattern
C.import_from_parquet(source="local_path/*.parquet", table="users")
# Unless modified via the callback_params argument, the default requirement is that the
# dst directory must be empty (consequence: will not execute further & raises exception)
# and that all data is saved into one file.
# read from table using a SQL statement & write to a parquet file which will be added to dst
C.export_to_parquet(dst="other_local_path", query_or_table="SELECT * FROM users")
# read from table by giving it as a string & write to a parquet file which will be added to dst
C.export_to_parquet(dst="other_local_path", query_or_table="users")