示例#1
0

@click.command(
    context_settings=CONTEXT_SETTINGS,
    short_help='Imports a file from local to the Databricks workspace.')
@click.argument('source_path')
@click.argument('target_path')
@click.option('--language',
              '-l',
              required=True,
              type=LanguageClickType(),
              help=', '.join(WorkspaceLanguage.ALL))
@click.option('--format',
              '-f',
              default=WorkspaceFormat.SOURCE,
              type=FormatClickType())
@click.option('--overwrite', '-o', is_flag=True, default=False)
@debug_option
@profile_option
@eat_exceptions
@provide_api_client
def import_workspace_cli(api_client, source_path, target_path, language,
                         format, overwrite):  # NOQA
    """
    Imports a file from local to the Databricks workspace.

    The format is by default SOURCE. Possible formats are SOURCE, HTML, JUPTYER, and DBC. Each
    format is documented at
    https://docs.databricks.com/api/latest/workspace.html#notebookexportformat.
    """
    WorkspaceApi(api_client).import_workspace(source_path, target_path,
示例#2
0
def mkdirs_cli(workspace_path):
    """
    Make directories in the Databricks Workspace.

    Mkdirs will create directories along the path to the argument directory.
    """
    mkdirs(workspace_path)


@click.command(context_settings=CONTEXT_SETTINGS,
               short_help='Imports a file from local to the Databricks workspace.')
@click.argument('source_path')
@click.argument('target_path')
@click.option('--language', '-l', required=True, type=LanguageClickType(),
              help=', '.join(WorkspaceLanguage.ALL))
@click.option('--format', '-f', default=WorkspaceFormat.SOURCE, type=FormatClickType())
@click.option('--overwrite', '-o', is_flag=True, default=False)
@require_config
@eat_exceptions
def import_workspace_cli(source_path, target_path, language, format, overwrite): # NOQA
    """
    Imports a file from local to the Databricks workspace.

    The format is by default SOURCE. Possible formats are SOURCE, HTML, JUPTYER, and DBC. Each
    format is documented at
    https://docs.databricks.com/api/latest/workspace.html#notebookexportformat.
    """
    import_workspace(source_path, target_path, language, format, overwrite) # NOQA


@click.command(context_settings=CONTEXT_SETTINGS,