Skip to content

superset-cli does not work with superset 3.0.0 #244

@FridrikLax

Description

@FridrikLax

Looks like import-assets and sync commands in superset-cli (0.2.8) do not work with superset version 3.0.0
Tried it with both basic authentication and jwt. Works with 2.1.0 but fails on 3.0.0.

Sample command:
superset-cli --jwt-token {jwt_token} --loglevel debug {HOST} sync native ./

The error

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/username/.pyenv/versions/local-dev/bin/superset-cli", line 8, in <module>
    sys.exit(superset_cli())
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/preset_cli/cli/superset/sync/native/command.py", line 239, in native
    import_resources(contents, client, overwrite)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/preset_cli/cli/superset/sync/native/command.py", line 366, in import_resources
    client.import_zip("assets", buf, overwrite=overwrite)
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/preset_cli/api/clients/superset.py", line 742, in import_zip
    payload = response.json()
  File "/Users/username/.pyenv/versions/local-dev/lib/python3.9/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

When using jwt-token, line 736 in superset.py returns a response object that contains HTML (authentication failed) so it fails in line 742 when trying to extract json

When using basic auth it fails even earlier

[15:56:00] DEBUG    [[15:56:00]] DEBUG: urllib3.connectionpool: Starting new HTTP connection (1):        connectionpool.py:228
                    localhost:8090
[15:56:01] DEBUG    [[15:56:01]] DEBUG: urllib3.connectionpool: http://localhost:8090/ "GET /login/       connectionpool.py:456
                    HTTP/1.1" 200 51619
           DEBUG    [[15:56:01]] DEBUG: urllib3.connectionpool: http://localhost:8090/ "POST /login/      connectionpool.py:456
                    HTTP/1.1" 302 201
           DEBUG    [[15:56:01]] DEBUG: urllib3.connectionpool: http://localhost:8090/ "GET /login/       connectionpool.py:456
                    HTTP/1.1" 200 51620
           DEBUG    [[15:56:01]] DEBUG: preset_cli.api.clients.superset: GET                                   superset.py:433
                    http://localhost:8090/api/v1/database/?q=(filters:!(),order_column:changed_on_delta_humani
                    zed,order_direction:desc,page:0,page_size:100)
           DEBUG    [[15:56:01]] DEBUG: urllib3.connectionpool: http://localhost:8090/ "GET               connectionpool.py:456
                    /api/v1/database/?q=(filters:!(),order_column:changed_on_delta_humanized,order_direc
                    tion:desc,page:0,page_size:100) HTTP/1.1" 401 39
           DEBUG    [[15:56:01]] DEBUG: urllib3.connectionpool: Starting new HTTP connection (2):        connectionpool.py:228
                    localhost:8090
[15:56:03] DEBUG    [[15:56:03]] DEBUG: urllib3.connectionpool: http://localhost:8090/ "GET /login/       connectionpool.py:456
                    HTTP/1.1" 200 51620
           DEBUG    [[15:56:03]] DEBUG: urllib3.connectionpool: http://localhost:8090/ "POST /login/      connectionpool.py:456
                    HTTP/1.1" 302 201
           DEBUG    [[15:56:03]] DEBUG: urllib3.connectionpool: http://localhost:8090/ "GET /login/
           

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions