dosubot[bot] commented on issue #33802:
URL: https://github.com/apache/superset/issues/33802#issuecomment-2981028591
<!-- Answer -->
The HTTP 422 and "Could not find a valid command to import file" errors
usually mean the ZIP file structure or the form field names in your API request
don't match what Superset expects.
For each asset type (databases, datasets, charts, dashboards), the ZIP
should have a top-level folder named exactly as the asset type, containing the
relevant YAML files. For example, for a database import, your ZIP should look
like:
```
databases/
MyDatabase.yaml
```
For datasets:
```
datasets/
MyDataset.yaml
databases/
MyDatabase.yaml
```
For charts:
```
charts/
MyChart.yaml
datasets/
MyDataset.yaml
databases/
MyDatabase.yaml
```
For dashboards:
```
dashboards/
MyDashboard.yaml
charts/
MyChart.yaml
datasets/
MyDataset.yaml
databases/
MyDatabase.yaml
```
Each asset references its dependencies, so you must include all related
YAMLs in the correct folders inside the ZIP. If you only include a single YAML
or the folder name doesn't match, you'll get the error you're seeing. The API
expects the form field to be named `formData` for these endpoints, which you
are already using correctly.
There were no breaking changes in the import structure between 4.0.2 and
4.1.2, so this is almost certainly a structural issue with the ZIP contents or
folder names, not a version problem. More details and examples are in the
[official
docs](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/docs/docs/configuration/importing-exporting-datasources.mdx)
and the [import API
code](https://github.com/apache/superset/blob/4d6cdf4fea44164e5953357ceceb44c93cdee8e3/superset/importexport/api.py).
If you want to import only a subset of assets and let Superset use existing
dependencies, you can try the `sparse` option (if available in your version),
but by default, all dependencies must be present in the ZIP for a successful
import.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
---
<sup>How did I do?
[Good](https://app.dosu.dev/response-feedback/429ee603-7bfb-4bc0-a02c-eb8294f0625a?feedback_type=great_response)
|
[Irrelevant](https://app.dosu.dev/response-feedback/429ee603-7bfb-4bc0-a02c-eb8294f0625a?feedback_type=irrelevant_answer)
|
[Incorrect](https://app.dosu.dev/response-feedback/429ee603-7bfb-4bc0-a02c-eb8294f0625a?feedback_type=incorrect_sources)
|
[Verbose](https://app.dosu.dev/response-feedback/429ee603-7bfb-4bc0-a02c-eb8294f0625a?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/429ee603-7bfb-4bc0-a02c-eb8294f0625a?feedback_type=hallucination)
| [Report
🐛](https://app.dosu.dev/response-feedback/429ee603-7bfb-4bc0-a02c-eb8294f0625a?feedback_type=bug_report)
|
[Other](https://app.dosu.dev/response-feedback/429ee603-7bfb-4bc0-a02c-eb8294f0625a?feedback_type=other)</sup> [](https://go.dosu.dev/discord-bot) [!
[Share on
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/33802)
--
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]