示例#1
0
def para_position(index: int) -> Dict[str, Any]:
    """Return dictionary for position parameter used by some Vizual moduels.

    Returns
    -------
    dict
    """
    return pckg.parameter_declaration(PARA_POSITION,
                                      name='Position',
                                      data_type=pckg.DT_INT,
                                      index=index)
示例#2
0
def para_row_id(index: int) -> Dict[str, Any]:
    """Return dictionary specifying the a row identifier parameter (currently
    used by the update cell command).

    Returns
    -------
    dict
    """
    return pckg.parameter_declaration(PARA_ROW,
                                      name='Row',
                                      data_type=pckg.DT_ROW_ID,
                                      index=index)
示例#3
0
def para_row_index(index: int) -> Dict[str, Any]:
    """Return dictionary specifying the default row parameter used by most
    modules.

    Returns
    -------
    dict
    """
    return pckg.parameter_declaration(PARA_ROW,
                                      name='Row',
                                      data_type=pckg.DT_ROW_INDEX,
                                      index=index)
示例#4
0
def para_materialize_input(index: int) -> Dict[str, Any]:
    """Return dictionary for 'materializeInput' parameter of Mimir lenses.

    Returns
    -------
    dict
    """
    return pckg.parameter_declaration(identifier=PARA_MATERIALIZE_INPUT,
                                      name='Materialize Input',
                                      data_type=pckg.DT_BOOL,
                                      index=index,
                                      required=False,
                                      hidden=True)
示例#5
0
 pckg.command_declaration(identifier=VIZUAL_DROP_DS,
                          name='Drop Dataset',
                          parameters=[pckg.para_dataset(0)],
                          format=[
                              pckg.constant_format('DROP'),
                              pckg.constant_format('DATASET'),
                              pckg.variable_format(pckg.PARA_DATASET)
                          ]),
 pckg.command_declaration(identifier=VIZUAL_INS_COL,
                          name='Insert Column',
                          parameters=[
                              pckg.para_dataset(0),
                              para_position(2),
                              pckg.parameter_declaration(
                                  identifier=pckg.PARA_NAME,
                                  name='Column Name',
                                  data_type=pckg.DT_STRING,
                                  index=1)
                          ],
                          format=[
                              pckg.constant_format('INSERT'),
                              pckg.constant_format('COLUMN'),
                              pckg.variable_format(pckg.PARA_NAME),
                              pckg.constant_format('INTO'),
                              pckg.variable_format(pckg.PARA_DATASET),
                              pckg.constant_format('AT'),
                              pckg.constant_format('POSITION'),
                              pckg.variable_format(PARA_POSITION)
                          ]),
 pckg.command_declaration(
     identifier=VIZUAL_INS_ROW,
示例#6
0
         pckg.constant_format('DOMAIN'),
         pckg.constant_format('FOR'),
         pckg.variable_format(pckg.PARA_COLUMN),
         pckg.constant_format('IN'),
         pckg.variable_format(pckg.PARA_DATASET)
     ]
 ),
 pckg.command_declaration(
     identifier=MIMIR_GEOCODE,
     name='Geocode Lens',
     parameters=[
         pckg.para_dataset(0),
         pckg.parameter_declaration(
             identifier=PARA_HOUSE_NUMBER,
             name='House Nr.',
             data_type=pckg.DT_COLUMN_ID,
             index=1,
             required=False
         ),
         pckg.parameter_declaration(
             identifier=PARA_STREET,
             name='Street',
             data_type=pckg.DT_COLUMN_ID,
             index=2,
             required=False
         ),
         pckg.parameter_declaration(
             identifier=PARA_CITY,
             name='City',
             data_type=pckg.DT_COLUMN_ID,
             index=3,
示例#7
0
 pckg.command_declaration(identifier=VIZUAL_DROP_DS,
                          name='Drop Dataset',
                          parameters=[pckg.para_dataset(0)],
                          format=[
                              pckg.constant_format('DROP'),
                              pckg.constant_format('DATASET'),
                              pckg.variable_format(pckg.PARA_DATASET)
                          ]),
 pckg.command_declaration(identifier=VIZUAL_INS_COL,
                          name='Insert Column',
                          parameters=[
                              pckg.para_dataset(0),
                              para_position(2),
                              pckg.parameter_declaration(
                                  identifier=pckg.PARA_NAME,
                                  name='Column Name',
                                  data_type=pckg.DT_STRING,
                                  index=1)
                          ],
                          format=[
                              pckg.constant_format('INSERT'),
                              pckg.constant_format('COLUMN'),
                              pckg.variable_format(pckg.PARA_NAME),
                              pckg.constant_format('INTO'),
                              pckg.variable_format(pckg.PARA_DATASET),
                              pckg.constant_format('AT'),
                              pckg.constant_format('POSITION'),
                              pckg.variable_format(PARA_POSITION)
                          ]),
 pckg.command_declaration(
     identifier=VIZUAL_INS_ROW,
示例#8
0
# Command identifier (unique within the package)
SCALA_CODE = 'code'

# Scala source code parameter
PARA_SCALA_SOURCE = 'source'
"""Define the scala cell command structure."""
SCALA_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_SCALA,
    commands=[
        pckg.command_declaration(
            identifier=SCALA_CODE,
            name='Scala Script',
            parameters=[
                pckg.parameter_declaration(identifier=PARA_SCALA_SOURCE,
                                           name='Scala Code',
                                           data_type=pckg.DT_CODE,
                                           language='scala',
                                           index=0)
            ],
            format=[pckg.variable_format(PARA_SCALA_SOURCE)])
    ])

# ------------------------------------------------------------------------------
# Helper Methods
# ------------------------------------------------------------------------------


def export_package(filename, format='YAML'):
    """Write package specification to the given file.

    Parameters
示例#9
0
PARA_XAXIS = 'xaxis'
PARA_XAXIS_COLUMN = PARA_XAXIS + '_' + pckg.PARA_COLUMN
PARA_XAXIS_RANGE = PARA_XAXIS + '_' + PARA_RANGE

# Declaration of plot package commands
PLOT_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_PLOT,
    commands=[
        pckg.command_declaration(
            identifier=PLOT_SIMPLE_CHART,
            name='Simple Chart',
            parameters=[
                pckg.para_dataset(0),
                pckg.parameter_declaration(identifier=pckg.PARA_NAME,
                                           name='Chart Name',
                                           data_type=pckg.DT_STRING,
                                           index=1,
                                           required=False),
                pckg.parameter_declaration(identifier=PARA_SERIES,
                                           name='Data Series',
                                           data_type=pckg.DT_LIST,
                                           index=2),
                pckg.parameter_declaration(identifier=PARA_SERIES_COLUMN,
                                           name='Column',
                                           data_type=pckg.DT_COLUMN_ID,
                                           index=3,
                                           parent=PARA_SERIES),
                pckg.parameter_declaration(identifier=PARA_SERIES_RANGE,
                                           name='Range',
                                           data_type=pckg.DT_STRING,
                                           index=4,
示例#10
0
# Command identifier (unique within the package)
PYTHON_CODE = 'code'

# Python source code parameter
PYTHON_SOURCE = 'source'
"""Define the python cell command structure."""
PYTHON_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_PYTHON,
    commands=[
        pckg.command_declaration(identifier=PYTHON_CODE,
                                 name='Python Script',
                                 parameters=[
                                     pckg.parameter_declaration(
                                         identifier=PYTHON_SOURCE,
                                         name='Python Code',
                                         data_type=pckg.DT_CODE,
                                         language='python',
                                         index=0)
                                 ],
                                 format=[pckg.variable_format(PYTHON_SOURCE)])
    ])

# ------------------------------------------------------------------------------
# Helper Methods
# ------------------------------------------------------------------------------


def export_package(filename, format='YAML'):
    """Write package specification to the given file.

    Parameters
示例#11
0
                                      required=False,
                                      hidden=True)


MIMIR_LENSES = pckg.package_declaration(
    identifier=PACKAGE_MIMIR,
    category=CATEGORY_MIMIR,
    commands=[
        pckg.command_declaration(
            identifier=MIMIR_GEOCODE,
            name='Geocode',
            parameters=[
                pckg.para_dataset(0),
                pckg.parameter_declaration(identifier=PARA_HOUSE_NUMBER,
                                           name='House Nr.',
                                           data_type=pckg.DT_COLUMN_ID,
                                           index=1,
                                           required=False),
                pckg.parameter_declaration(identifier=PARA_STREET,
                                           name='Street',
                                           data_type=pckg.DT_COLUMN_ID,
                                           index=2,
                                           required=False),
                pckg.parameter_declaration(identifier=PARA_CITY,
                                           name='City',
                                           data_type=pckg.DT_COLUMN_ID,
                                           index=3,
                                           required=False),
                pckg.parameter_declaration(identifier=PARA_STATE,
                                           name='State',
                                           data_type=pckg.DT_COLUMN_ID,
示例#12
0
# Command identifier (unique within the package)
MARKDOWN_CODE = 'code'

# Markdown source code parameter
PARA_MARKDOWN_SOURCE = 'source'
"""Define the markdown cell command structure."""
MARKDOWN_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_MARKDOWN,
    commands=[
        pckg.command_declaration(
            identifier=MARKDOWN_CODE,
            name='Markdown Script',
            parameters=[
                pckg.parameter_declaration(identifier=PARA_MARKDOWN_SOURCE,
                                           name='Markdown Code',
                                           data_type=pckg.DT_CODE,
                                           language='markdown',
                                           index=0)
            ],
            format=[pckg.variable_format(PARA_MARKDOWN_SOURCE)])
    ])

# ------------------------------------------------------------------------------
# Helper Methods
# ------------------------------------------------------------------------------


def export_package(filename, format='YAML'):
    """Write package specification to the given file.

    Parameters
示例#13
0
# Python source code parameter
PYTHON_SOURCE = 'source'

# Format
OUTPUT_FORMAT = 'format'
"""Define the python cell command structure."""
PYTHON_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_PYTHON,
    commands=[
        pckg.command_declaration(
            identifier=PYTHON_CODE,
            name='Python Script',
            parameters=[
                pckg.parameter_declaration(identifier=PYTHON_SOURCE,
                                           name='Python Code',
                                           data_type=pckg.DT_CODE,
                                           language='python',
                                           index=0),
                pckg.parameter_declaration(identifier=OUTPUT_FORMAT,
                                           name='Output Format',
                                           data_type=pckg.DT_STRING,
                                           index=1,
                                           default_value=OUTPUT_TEXT,
                                           hidden=True,
                                           required=False)
            ],
            format=[pckg.variable_format(PYTHON_SOURCE)])
    ])

# ------------------------------------------------------------------------------
# Helper Methods
示例#14
0
# Package name
PACKAGE_DATA = 'data'
DATA_MATERIALIZE = 'materialize'

DATA_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_DATA,
    category="code",
    commands=[
        pckg.command_declaration(
            identifier=VIZUAL_LOAD,
            name='Load Dataset',
            suggest=False,
            parameters=[
                pckg.parameter_declaration(identifier=pckg.PARA_NAME,
                                           name='Dataset Name',
                                           data_type=pckg.DT_STRING,
                                           index=0),
                pckg.parameter_declaration(identifier=PARA_FILE,
                                           name='Source File',
                                           data_type=pckg.DT_FILE_ID,
                                           index=1),
                pckg.parameter_declaration(
                    PARA_LOAD_FORMAT,
                    name='Load Format',
                    data_type=pckg.DT_STRING,
                    values=[
                        pckg.enum_value(value='csv',
                                        text='CSV',
                                        is_default=True),
                        pckg.enum_value(value='json', text='JSON'),
                        pckg.enum_value(
示例#15
0
# Command identifier (unique within the package)
R_CODE = 'code'

# R source code parameter
PARA_R_SOURCE = 'source'
"""Define the r cell command structure."""
R_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_R,
    commands=[
        pckg.command_declaration(identifier=R_CODE,
                                 name='R Script',
                                 parameters=[
                                     pckg.parameter_declaration(
                                         identifier=PARA_R_SOURCE,
                                         name='R Code',
                                         data_type=pckg.DT_CODE,
                                         language='r',
                                         index=0)
                                 ],
                                 format=[pckg.variable_format(PARA_R_SOURCE)])
    ])

# ------------------------------------------------------------------------------
# Helper Methods
# ------------------------------------------------------------------------------


def export_package(filename, format='YAML'):
    """Write package specification to the given file.

    Parameters
示例#16
0
SQL_QUERY = 'query'

# SQL command parameters
PARA_OUTPUT_DATASET = 'output_dataset'
PARA_SQL_SOURCE = 'source'
"""Define SQL command structure."""
SQL_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_SQL,
    commands=[
        pckg.command_declaration(
            identifier=SQL_QUERY,
            name='SQL Query',
            parameters=[
                pckg.parameter_declaration(identifier=PARA_SQL_SOURCE,
                                           name='SQL Code',
                                           data_type=pckg.DT_CODE,
                                           language='sql',
                                           index=0),
                pckg.parameter_declaration(identifier=PARA_OUTPUT_DATASET,
                                           name='Output Dataset',
                                           data_type=pckg.DT_STRING,
                                           index=1,
                                           required=False)
            ],
            format=[
                pckg.variable_format(PARA_SQL_SOURCE),
                pckg.optional_format(PARA_OUTPUT_DATASET, prefix='AS ')
            ])
    ])

# ------------------------------------------------------------------------------