-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade pyarrow to fix S3 segfaults (#7)
* Bump arrow all the way to latest * Add extra module support - closes #4 * Version bump
- Loading branch information
Showing
6 changed files
with
145 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import deltalake | ||
|
||
from faker_cli.writers.parquet import ParquetWriter | ||
|
||
|
||
class DeltaLakeWriter(ParquetWriter): | ||
def close(self): | ||
deltalake.write_deltalake(table_or_uri=self.filename, data=self.table) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
import pyarrow as pa | ||
import pyarrow.parquet as pq | ||
|
||
from faker_cli.writer import Writer | ||
|
||
class ParquetWriter(Writer): | ||
def __init__(self, output, headers, filename): | ||
super().__init__(output, headers) | ||
self.filename = filename | ||
self.table: pa.Table = None | ||
|
||
def write(self, row): | ||
ini_dict = [{k: [v]} for k, v in list(zip(self.headers, row))] | ||
tbl = {k: v for d in ini_dict for k, v in d.items()} | ||
table = pa.table(tbl) | ||
if self.table is None: | ||
self.table = table | ||
else: | ||
self.table = pa.concat_tables([self.table, table]) | ||
|
||
def close(self): | ||
pq.write_table(self.table, self.filename) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.