Skip to content

Commit

Permalink
Major improvements
Browse files Browse the repository at this point in the history
* Add write_pyarrow method
* Update version
  • Loading branch information
jzsmoreno committed Sep 16, 2023
1 parent d3163dc commit f312fc6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions pydbsmgr/utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import yaml
from numpy import datetime64
from pandas.core.frame import DataFrame
from pyarrow import Table


def replace_numbers_with_letters(input_string: str) -> str:
Expand Down Expand Up @@ -55,6 +56,24 @@ class ControllerFeatures:
def __init__(self, _container_client):
self._container_client = _container_client

def write_pyarrow(
self,
directory_name: str,
pytables: List[Table],
names: List[str],
overwrite: bool = True,
) -> None:
"""Write pyarrow table as `parquet` format"""
format_type = "parquet"
for table, blob_name in zip(pytables, names):
buf = pa.BufferOutputStream()
pq.write_table(table, buf)
parquet_data = buf.getvalue().to_pybytes()
blob_path_name = directory_name + "/" + blob_name
self._container_client.upload_blob(
name=blob_path_name + "." + format_type, data=parquet_data, overwrite=overwrite
)

def write_parquet(
self,
directory_name: str,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="pydbsmgr",
version="0.3.6",
version="0.3.7",
author="J. A. Moreno-Guerra",
author_email="[email protected]",
description="Testing installation of Package",
Expand Down

0 comments on commit f312fc6

Please sign in to comment.