Source code for node_import_table
# This file is part of Sympathy for Data.
# Copyright (c) 2013, 2017, Combine Control Systems AB
#
# SYMPATHY FOR DATA COMMERCIAL LICENSE
# You should have received a link to the License with Sympathy for Data.
import os
from sylib.importer import base
from sympathy.api import node as synode
from sympathy.api import importers
from sympathy.api.nodeconfig import Port, Ports
from sylib import docs
GENERIC_DOCS = """
Imports data from a wide selection of formats (CSV, HDF5, Parquet, XLSX, Matlab, etc.).
The format of the data is automatically detected, but for proper functionality the node might need
to be configured. The data is imported as the Table datatype which can be used by the majority of
the nodes in Sympathy.
"""
def _output_item_filename_hook(output_item, filename):
if not output_item.name:
output_item.name = os.path.splitext(
os.path.basename(filename))[0]
[docs]
class ImportTable(base.ImportSingle, synode.Node):
__doc__ = GENERIC_DOCS + docs.IMPORTER_DOCS + base.URL_DOC
author = "Alexander Busck"
name = 'Table'
description = 'Import data from a datasource in table format'
nodeid = 'org.sysess.sympathy.data.table.importtable'
icon = 'import_table.svg'
outputs = Ports([Port.Table('Imported Table', name='port1')])
plugins = (importers.TableDataImporterBase, )
related = [
'org.sysess.sympathy.data.table.importtablemultiple',
'org.sysess.sympathy.export.exporttables',
]
def _output_item_filename_hook(self, output_item, filename):
_output_item_filename_hook(output_item, filename)
[docs]
class ImportTables(base.ImportMulti, synode.Node):
__doc__ = GENERIC_DOCS + docs.IMPORTER_DOCS + base.URL_DOC
author = "Alexander Busck"
name = 'Tables'
description = 'Import data from multiple datasources as a list of Tables.'
nodeid = 'org.sysess.sympathy.data.table.importtablemultiple'
icon = 'import_table.svg'
outputs = Ports([Port.Tables('Imported Tables', name='port1')])
plugins = (importers.TableDataImporterBase, )
related = [
'org.sysess.sympathy.data.table.importtable',
'org.sysess.sympathy.export.exporttables',
]
def _output_item_filename_hook(self, output_item, filename):
_output_item_filename_hook(output_item, filename)