Hi everyone! :rainbow-daggy: I am trying to use th...
# ask-community
Hi everyone! 🌈 I am trying to use the "import via manifest.json" to import the assets from a dbt project. I used the same code written in the docs, but I receive this error: AttributeError: 'str' object has no attribute 'read'. I checked with an online tool and mi JSON is perfectly valid. What could be the problem here? 🤨
Based on the error message I’d think you need to pass a file object instead of a stringified JSON. maybe something like:
Copy code
with open('manifest.json') as f:
why not load with
❤️ 1
I am trying to use this method to check if it allows to run one singular model at a time after importing all of them at once. Right now I am importing one model at a time, like this:
dbt_assets_1 = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR, select="first_dbt")
dbt_assets_2 = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR, select="second_dbt")
dbt_assets_3 = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR, select="third_dbt")
dbt_assets_4 = load_assets_from_dbt_project(project_dir=DBT_PROJECT_DIR, select="fourth_dbt")
In this way I can select only one model in the dag and run it singularly, but the downside is that I need to define each asset.
... Just did some tweaks to your suggestion and tried the import via manifest, but it doesn't work as I need it to. It still runs all the models even if I select only one. Thank you for your help anyway yay
If you’re selecting the assets it should only run one, if you’re running it from a job, you can always do something like
[define_asset_job(asset) for asset in loaded_assets]
(obviously untested, probably need a few more parameters)
👍 1
shouldn't expect a file object. mind sharing the full stack trace?