devikaaaa33 opened a new issue, #33802:
URL: https://github.com/apache/superset/issues/33802
### Bug description
I am trying to import databases, datasets, dashboards and chats using API
calls. I am downloading theses from superset version 4.0.2 to 4.1.1 and getting
error as "=== Importing database from /tmp/repo/databases/databases.zip ===
ERROR: Failed to import database from /tmp/repo/databases/databases.zip.
HTTP response code: 422
Response body:
{"errors": [{"message": "Could not find a valid command to import file",
"error_type": "GENERIC_COMMAND_ERROR", "level": "warning", "extra":
{"issue_codes": [{"code": 1010, "message": "Issue 1010 - Superset encountered
an error while running a command."}]}}]}---
=== Importing dataset from /tmp/repo/datasets/datasets.zip ===
ERROR: Failed to import dataset from /tmp/repo/datasets/datasets.zip. HTTP
response code: 422
Response body:
{"errors": [{"message": "Could not find a valid command to import file",
"error_type": "GENERIC_COMMAND_ERROR", "level": "warning", "extra":
{"issue_codes": [{"code": 1010, "message": "Issue 1010 - Superset encountered
an error while running a command."}]}}]}---
=== Importing chart from /tmp/repo/charts/charts.zip ===
ERROR: Failed to import chart from /tmp/repo/charts/charts.zip. HTTP
response code: 422
Response body:
{"errors": [{"message": "Could not find a valid command to import file",
"error_type": "GENERIC_COMMAND_ERROR", "level": "warning", "extra":
{"issue_codes": [{"code": 1010, "message": "Issue 1010 - Superset encountered
an error while running a command."}]}}]}---"
Please let me know what folder structure I have to use for these assets
# --- Import Databases ---
echo "---"
echo "=== Importing database from $DB_ZIP ==="
db_response=$(curl -k -s -w "%{http_code}" -b cookies.txt -o
db_response_body.txt \
--url "https://$APP_PREFIX.$DOMAIN/api/v1/database/import/" \
--header 'accept: application/json' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header 'content-type: multipart/form-data' \
--header "referer: https://$APP_PREFIX.$DOMAIN" \
--header "x-csrftoken: $CSRF_TOKEN" \
--form "formData=@$DB_ZIP" \
--form overwrite=true \
--form "passwords={\"databases/Reporting.yaml\":
\"$DASHBOARD_DB_PASS\"}")
if [ "$db_response" -eq 200 ]; then
echo "Successfully imported database from $DB_ZIP."
else
echo "ERROR: Failed to import database from $DB_ZIP. HTTP response code:
$db_response"
echo "Response body:"
cat db_response_body.txt
fi
# --- Import Datasets ---
echo "---"
echo "=== Importing dataset from $DATASET_ZIP ==="
dataset_response=$(curl -k -s -w "%{http_code}" -b cookies.txt -o
dataset_response_body.txt \
--url "https://$APP_PREFIX.$DOMAIN/api/v1/dataset/import/" \
--header 'accept: application/json' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header 'content-type: multipart/form-data' \
--header "referer: https://$APP_PREFIX.$DOMAIN" \
--header "x-csrftoken: $CSRF_TOKEN" \
--form "formData=@$DATASET_ZIP" \
--form overwrite=true \
--form "passwords={\"databases/Reporting.yaml\":
\"$DASHBOARD_DB_PASS\"}")
if [ "$dataset_response" -eq 200 ]; then
echo "Successfully imported dataset from $DATASET_ZIP."
else
echo "ERROR: Failed to import dataset from $DATASET_ZIP. HTTP response
code: $dataset_response"
echo "Response body:"
cat dataset_response_body.txt
fi
# --- Import Charts ---
echo "---"
echo "=== Importing chart from $CHART_ZIP ==="
chart_response=$(curl -k -s -w "%{http_code}" -b cookies.txt -o
chart_response_body.txt \
--url "https://$APP_PREFIX.$DOMAIN/api/v1/chart/import/" \
--header 'accept: application/json' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header 'content-type: multipart/form-data' \
--header "referer: https://$APP_PREFIX.$DOMAIN" \
--header "x-csrftoken: $CSRF_TOKEN" \
--form "formData=@$CHART_ZIP" \
--form overwrite=true \
--form "passwords={\"databases/Reporting.yaml\":
\"$DASHBOARD_DB_PASS\"}")
if [ "$chart_response" -eq 200 ]; then
echo "Successfully imported chart from $CHART_ZIP."
else
echo "ERROR: Failed to import chart from $CHART_ZIP. HTTP response code:
$chart_response"
echo "Response body:"
cat chart_response_body.txt
fi
# --- Import Dashboards ---
echo "---"
echo "=== Importing dashboard from $DASHBOARD_ZIP ==="
dashboard_response=$(curl -k -s -w "%{http_code}" -b cookies.txt -o
dashboard_response_body.txt \
--url "https://$APP_PREFIX.$DOMAIN/api/v1/dashboard/import/" \
--header 'accept: application/json' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header 'content-type: multipart/form-data' \
--header "referer: https://$APP_PREFIX.$DOMAIN" \
--header "x-csrftoken: $CSRF_TOKEN" \
--form "formData=@$DASHBOARD_ZIP" \
--form overwrite=true \
--form "passwords={\"databases/Reporting.yaml\":
\"$DASHBOARD_DB_PASS\"}")
if [ "$dashboard_response" -eq 200 ]; then
echo "Successfully imported dashboard from $DASHBOARD_ZIP."
### Screenshots/recordings
<img width="620" alt="Image"
src="https://github.com/user-attachments/assets/873834c1-08f5-48ee-8375-73bb9417160d"
/>
<img width="509" alt="Image"
src="https://github.com/user-attachments/assets/db62ec1b-4490-4559-836e-0b93cd1789ec"
/>
<img width="463" alt="Image"
src="https://github.com/user-attachments/assets/50167786-5060-4db2-b691-983d9f570b72"
/>
<img width="620" alt="Image"
src="https://github.com/user-attachments/assets/a118c234-8cd7-48ed-a93c-c9f454ee5f6c"
/>
### Superset version
4.1.2
### Python version
3.10
### Node version
16
### Browser
Not applicable
### Additional context
_No response_
### Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to
my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug
report.
- [x] I have checked Superset's logs for errors and if I found a relevant
Python stacktrace, I included it here as text in the "additional context"
section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]