-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
I am new to the dlthub tool so please take this with grain of salt. I might be doing this incorrectly on my end.
When generating a pipeline using dlt-init-openapi, the generated Python code contains outdated imports that cause an ImportError.
Steps to Reproduce:
- Run the following command to generate an OpenAPI-based pipeline:
dlt-init-openapi hacker_news_api_swagger --no-interactive --url "https://gist.githubusercontent.com/wing328/44a6cb6c899feda4c2bd44747e9dcbc8/raw/737d3cf34daeef32280c66c5790c7de1a7b26905/hacker_news_api_swagger.json"
1.1 I tested with a local file as well:
dlt-init-openapi openweather_source --path
openapi_source_generator/openweather_openapi.yml```
2.This generates a directory with the source and pipeline files.
3. Inside the generated `hacker_news_api_swagger/__init__.py`, the following import is present: ```python
from rest_api import rest_api_source
from rest_api.typing import RESTAPIConfig
- When running the pipeline:
It raises:
python3 hacker_news_api_swagger_pipeline.py
ImportError: cannot import name 'rest_api_source' from 'rest_api'
Expected Behavior
The generated code should use the correct import:
from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources, rest_api_source
Metadata
Metadata
Assignees
Labels
No labels