Module export.table in plugin tabular v0.5.1
Export table data items.
| Author(s) | Markus Binsteiner (markus@frkl.io) |
| Tags | tabular |
| Python class | kiara_plugin.tabular.modules.table.ExportTableModule |
Module configuration options
Configuration class: kiara.modules.included_core_modules.export_as.DataExportModuleConfig
| Name | Description | Type | Required? | Default |
|---|---|---|---|---|
| source_type | The type of the source data that is going to be exported. | string | true | null |
| target_profile | The name of the target profile. Used to distinguish different target formats for the same data type. | string | true | null |
| constants | Value constants for this module. | object | false | null |
| defaults | Value defaults for this module. | object | false | null |
Module source code
class ExportTableModule(DataExportModule): """Export table data items."""
_module_type_name = "export.table"
def export__table__as__csv_file(self, value: KiaraTable, base_path: str, name: str): """Export a table as csv file."""
from pyarrow import csv
target_path = os.path.join(base_path, f"{name}.csv") csv.write_csv(value.arrow_table, target_path)
return {"files": target_path}
# def export__table__as__sqlite_db( # self, value: KiaraTable, base_path: str, name: str # ): # # target_path = os.path.abspath(os.path.join(base_path, f"{name}.sqlite")) # # raise NotImplementedError() # # shutil.copy2(value.db_file_path, target_path) # # return {"files": target_path}