Exemple #1
0
    """
    return pckg.parameter_declaration(PARA_ROW,
                                      name='Row',
                                      data_type=pckg.DT_ROW_INDEX,
                                      index=index)


VIZUAL_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_VIZUAL,
    commands=[
        pckg.command_declaration(
            identifier=VIZUAL_DEL_COL,
            name='Delete Column',
            parameters=[pckg.para_dataset(0),
                        pckg.para_column(1)],
            format=[
                pckg.constant_format('DELETE'),
                pckg.constant_format('COLUMN'),
                pckg.variable_format(pckg.PARA_COLUMN),
                pckg.constant_format('FROM'),
                pckg.variable_format(pckg.PARA_DATASET)
            ]),
        pckg.command_declaration(
            identifier=VIZUAL_DEL_ROW,
            name='Delete Row',
            parameters=[pckg.para_dataset(0),
                        para_row_id(1)],
            format=[
                pckg.constant_format('DELETE'),
                pckg.constant_format('ROW'),
                pckg.variable_format(PARA_ROW),
                pckg.constant_format('FROM'),
Exemple #2
0
    """
    return pckg.parameter_declaration(PARA_ROW,
                                      name='Row',
                                      data_type=pckg.DT_ROW_INDEX,
                                      index=index)


VIZUAL_COMMANDS = pckg.package_declaration(
    identifier=PACKAGE_VIZUAL,
    commands=[
        pckg.command_declaration(
            identifier=VIZUAL_DEL_COL,
            name='Delete Column',
            parameters=[pckg.para_dataset(0),
                        pckg.para_column(1)],
            format=[
                pckg.constant_format('DELETE'),
                pckg.constant_format('COLUMN'),
                pckg.variable_format(pckg.PARA_COLUMN),
                pckg.constant_format('FROM'),
                pckg.variable_format(pckg.PARA_DATASET)
            ]),
        pckg.command_declaration(
            identifier=VIZUAL_DEL_ROW,
            name='Delete Row',
            parameters=[pckg.para_dataset(0),
                        para_row_index(1)],
            format=[
                pckg.constant_format('DELETE'),
                pckg.constant_format('ROW'),
                pckg.variable_format(PARA_ROW),
                pckg.constant_format('FROM'),
Exemple #3
0
        required=False,
        hidden=True
    )


MIMIR_LENSES = pckg.package_declaration(
    identifier=PACKAGE_MIMIR,
    commands=[
        pckg.command_declaration(
            identifier=MIMIR_DOMAIN,
            name='Domain Lens',
            parameters=[
                pckg.para_dataset(0),
                pckg.para_column(1),
                para_materialize_input(2)
            ],
            format=[
                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.',
Exemple #4
0
 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,
                                    parent=PARA_SERIES,
                                    required=False),
         pckg.parameter_declaration(identifier=PARA_SERIES_LABEL,
                                    name='Label',
                                    data_type=pckg.DT_STRING,
                                    index=5,
                                    parent=PARA_SERIES,
                                    required=False),
         pckg.parameter_declaration(identifier=PARA_XAXIS,
                                    name='X-Axis',
                                    data_type=pckg.DT_RECORD,
                                    index=6,
                                    required=False),
         pckg.parameter_declaration(identifier=PARA_XAXIS_COLUMN,
                                    name='Column',
                                    data_type=pckg.DT_COLUMN_ID,
                                    index=7,
                                    parent=PARA_XAXIS,
                                    required=False),
         pckg.parameter_declaration(identifier=PARA_XAXIS_RANGE,
                                    name='Range',
                                    data_type=pckg.DT_STRING,
                                    index=8,
                                    parent=PARA_XAXIS,
                                    required=False),
         pckg.parameter_declaration(identifier=PARA_CHART,
                                    name='Chart',
                                    data_type=pckg.DT_RECORD,
                                    index=9),
         pckg.parameter_declaration(
             identifier=PARA_CHART_TYPE,
             name='Type',
             data_type=pckg.DT_STRING,
             index=10,
             values=[
                 pckg.enum_value(value='Area Chart'),
                 pckg.enum_value(value='Bar Chart', is_default=True),
                 pckg.enum_value(value='Line Chart'),
                 pckg.enum_value(value='Scatter Plot')
             ],
             parent=PARA_CHART),
         pckg.parameter_declaration(identifier=PARA_CHART_GROUPED,
                                    name='Grouped',
                                    data_type=pckg.DT_BOOL,
                                    index=11,
                                    parent=PARA_CHART)
     ],
     format=[
         pckg.constant_format('CREATE'),
         pckg.constant_format('PLOT'),
         pckg.variable_format(pckg.PARA_NAME),
         pckg.constant_format('FOR'),
         pckg.variable_format(pckg.PARA_DATASET)
     ])
Exemple #5
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.
Exemple #6
0
 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,
                                    index=4,
                                    required=False),
         pckg.parameter_declaration(identifier=PARA_GEOCODER,
                                    name='Geocoder',
                                    data_type=pckg.DT_STRING,
                                    index=5,
                                    values=[
                                        pckg.enum_value(
                                            value='GOOGLE',
                                            is_default=True),
                                        pckg.enum_value(value='OSM')
                                    ]),
         para_materialize_input(6)
     ],
     format=[
         pckg.constant_format('GEOCODE'),
         pckg.variable_format(pckg.PARA_DATASET),
         pckg.constant_format('COLUMNS'),
         pckg.optional_format(PARA_HOUSE_NUMBER,
                              prefix='HOUSE_NUMBER='),
         pckg.optional_format(PARA_STREET, prefix='STREET='),
         pckg.optional_format(PARA_CITY, prefix='CITY='),
         pckg.optional_format(PARA_STATE, prefix='STATE='),
         pckg.constant_format('USING'),
         pckg.variable_format(PARA_GEOCODER)
     ]),
Exemple #7
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.
Exemple #8
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.
Exemple #9
0
# 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
# ------------------------------------------------------------------------------

Exemple #10
0
 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(
                     value='mimir.exec.spark.datasource.pdf',
                     text='PDF'),
                 pckg.enum_value(
                     value=
                     'mimir.exec.spark.datasource.google.spreadsheet',
                     text='Google Sheet'),
                 pckg.enum_value(value='com.databricks.spark.xml',
                                 text='XML'),
                 pckg.enum_value(value='com.crealytics.spark.excel',
                                 text='Excel'),
                 pckg.enum_value(value='jdbc', text='JDBC Source'),
                 pckg.enum_value(value='text', text='Text'),
                 pckg.enum_value(value='parquet', text='Parquet'),
                 pckg.enum_value(value='orc', text='ORC'),
                 pckg.enum_value(value='org.vizierdb.publish.source',
                                 text='Published Dataset')
             ],
             index=2,
             required=True),
         pckg.parameter_declaration(
             PARA_SCHEMA,
             name='Schema (leave blank to guess)',
             data_type=pckg.DT_LIST,
             index=3,
             required=False),
         pckg.parameter_declaration(PARA_SCHEMA_COLUMN,
                                    name='Column Name',
                                    data_type=pckg.DT_STRING,
                                    index=4,
                                    parent=PARA_SCHEMA,
                                    required=False),
         pckg.parameter_declaration(
             PARA_SCHEMA_TYPE,
             name='Data Type',
             data_type=pckg.DT_STRING,
             index=5,
             parent=PARA_SCHEMA,
             required=False,
             values=[
                 pckg.enum_value(value=t,
                                 text=t,
                                 is_default=(t == "string"))
                 for t in [
                     "string", "real", "float", "boolean", "short",
                     "date", "timestamp", "int", "long", "byte"
                 ]
             ]),
         pckg.parameter_declaration(PARA_INFER_TYPES,
                                    name='Infer Types',
                                    data_type=pckg.DT_BOOL,
                                    index=6,
                                    default_value=True,
                                    hidden=True,
                                    required=False),
         pckg.parameter_declaration(PARA_DETECT_HEADERS,
                                    name='File Has Headers',
                                    data_type=pckg.DT_BOOL,
                                    index=7,
                                    default_value=True,
                                    required=False),
         pckg.parameter_declaration(
             PARA_LOAD_DSE,
             name='Data Source Error Annotations',
             data_type=pckg.DT_BOOL,
             hidden=True,
             index=8,
             required=False),
         pckg.parameter_declaration(PARA_LOAD_OPTIONS,
                                    name='Load Options',
                                    data_type=pckg.DT_LIST,
                                    index=9,
                                    required=False),
         pckg.parameter_declaration(PARA_LOAD_OPTION_KEY,
                                    name='Option Key',
                                    data_type=pckg.DT_STRING,
                                    index=10,
                                    parent=PARA_LOAD_OPTIONS,
                                    required=False),
         pckg.parameter_declaration(PARA_LOAD_OPTION_VALUE,
                                    name='Option Value',
                                    data_type=pckg.DT_STRING,
                                    index=11,
                                    parent=PARA_LOAD_OPTIONS,
                                    required=False)
     ],
     format=[
         pckg.constant_format('LOAD'),
         pckg.constant_format('DATASET'),
         pckg.variable_format(pckg.PARA_NAME),
         pckg.constant_format('FROM'),
         pckg.variable_format(PARA_FILE)
     ],
 ),
Exemple #11
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.
Exemple #12
0
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 ')
            ])
    ])

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