Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] dbt run stuck at python models #9935

Closed
2 tasks done
irisschen opened this issue Apr 15, 2024 · 6 comments
Closed
2 tasks done

[Bug] dbt run stuck at python models #9935

irisschen opened this issue Apr 15, 2024 · 6 comments
Labels
awaiting_response bug Something isn't working python_models stale Issues that have gone stale

Comments

@irisschen
Copy link

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

When running dbt with duckdb, I face an issue where the model execution process freezes indefinitely when it encounters a Python model during dbt run. No error messages are shown, and I can't stop it using ctrl+c.
However, if I run the Python model separately using dbt run -m python_model before running dbt run, then dbt mysteriously completes the execution without any problems.

Expected Behavior

dbt can successfully finish running without any errors

Steps To Reproduce

  1. dbt run

Relevant log output

No response

Environment

- OS: Mac OSX
- Python: Python 3.11.5
- dbt: 1.7.11

Which database adapter are you using with dbt?

other (mention it in "Additional Context")

Additional Context

No response

@irisschen irisschen added bug Something isn't working triage labels Apr 15, 2024
@dbeatty10 dbeatty10 self-assigned this Apr 15, 2024
@dbeatty10
Copy link
Contributor

Thanks for reaching out @irisschen.

Can you provide an example dbt python model that you are having problems with so that we can try to reproduce it?

And can you also share the version of dbt-duckdb that you are using?

@dbeatty10 dbeatty10 removed their assignment Apr 15, 2024
@irisschen
Copy link
Author

  • dbt-duckdb version: 1.7.3
  • Here is an example of my dbt Python model, thanks for your support.
def model(dbt, session):
    metadata_df = dbt.ref("src_base_persons").df()
    args = dbt.config.get("not_run_models")
    if str(dbt.this).split(".")[-1][1:-1] in args:
        metadata_df["translation"] = metadata_df["name"]
        return metadata_df

    metadata_df["translation"] = metadata_df["name"].map(translation)
    return metadata_df


def translation(artist):
    translator = kakasi()
    new_artist = ""
    translate = translator.convert(artist)
    for item in translate:
        new_artist += item["kana"]
    return new_artist

@dbeatty10
Copy link
Contributor

Thanks for sharing that @irisschen.

We'd still need a bit more information in order to try reproducing it. Could you also share the the following:

  • Simple model (or seed) for src_base_persons that has necessary columns like name and translation
  • Code or import statement for kakasi
  • Config details that includes how you are using the not_run_models config
  • Example command(s) that you are using and their output

For example

Here's the files I'm using currently:

models/src_base_persons.sql

select 'A' as name, '1' as translation

models/my_python_model.py

def model(dbt, session):
    metadata_df = dbt.ref("src_base_persons").df()
    return metadata_df

And here's a command that works fine for me:

dbt build -s +my_python_model

Here's the output:

$ dbt build -s +my_python_model
12:39:28  Running with dbt=1.7.10
12:39:28  Registered adapter: duckdb=1.7.3
12:39:28  Found 3 models, 0 sources, 0 exposures, 0 metrics, 391 macros, 0 groups, 0 semantic models
12:39:28  
12:39:28  Concurrency: 1 threads (target='duckdb')
12:39:28  
12:39:28  1 of 2 START sql view model dbt_dbeatty.src_base_persons ....................... [RUN]
12:39:28  1 of 2 OK created sql view model dbt_dbeatty.src_base_persons .................. [OK in 0.09s]
12:39:28  2 of 2 START python table model dbt_dbeatty.my_python_model .................... [RUN]
12:39:29  2 of 2 OK created python table model dbt_dbeatty.my_python_model ............... [OK in 0.74s]
12:39:29  
12:39:29  Finished running 1 view model, 1 table model in 0 hours 0 minutes and 0.99 seconds (0.99s).
12:39:29  
12:39:29  Completed successfully
12:39:29  
12:39:29  Done. PASS=2 WARN=0 ERROR=0 SKIP=0 TOTAL=2

Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label Jul 16, 2024
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

1 similar comment
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting_response bug Something isn't working python_models stale Issues that have gone stale
Projects
None yet
Development

No branches or pull requests

2 participants