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

Feature/python model beta #126

Merged
merged 29 commits into from
Sep 13, 2022
Merged

Feature/python model beta #126

merged 29 commits into from
Sep 13, 2022

Conversation

ueshin
Copy link
Collaborator

@ueshin ueshin commented Jul 8, 2022

Description

Ports the changes for python model v1 from dbt-spark but use APIs below instead.

@ueshin ueshin marked this pull request as ready for review July 30, 2022 02:09
@ueshin ueshin changed the title Feature/python model v1 Feature/python model beta Aug 1, 2022
@ueshin ueshin marked this pull request as draft August 3, 2022 22:26
@ueshin
Copy link
Collaborator Author

ueshin commented Aug 4, 2022

This is now based on #148. Please take a look at it first.

@ueshin ueshin marked this pull request as ready for review August 25, 2022 21:36
if status != "Finished":
raise dbt.exceptions.RuntimeException(
"python model run ended in state"
f"{status} with state_message\n{json_resp['results']['data']}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that if the python code actually failed, status will still be finish, but json_resp['results']['resultType'] will be error, and json_resp['results']['cause'] will contain traceback. I reused your code for jobs API and pushed the changes here. Feel free to review and let me know if any adjustment needed!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll address it.

password=token,
host=f"https://{host}",
api_version="1.2",
command_name=command_name,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this command_name being recorded somewhere after the run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be part of user agent in the API request.

Copy link
Collaborator Author

@ueshin ueshin Sep 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChenyuLInx @jtcohen6 btw, is it possible to set a simple string in the user agent of API requests of dbt-spark to identify the API calls are from dbt similar to ODBC connections?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtcohen6 I am not very familiar with what we did with ODBC connections, so I will defer it to you.
@ueshin feel free to open an issue in dbt-spark about this!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChenyuLInx I opened an issue in dbt-spark dbt-labs/dbt-spark#460. Thanks.

@zhengruifeng
Copy link
Collaborator

https://github.com/databricks/jaffle_shop/pull/1/files#r969108078
please take a look at this, it seems that python model cann't work with view materialization

@ueshin
Copy link
Collaborator Author

ueshin commented Sep 13, 2022

it seems that python model cann't work with view materialization

Yes, so far it's a limitation of python model.
https://docs.getdbt.com/docs/building-a-dbt-project/building-models/python-models#materializations

@zhengruifeng
Copy link
Collaborator

@ueshin Since it's a known issue, then I think this PR works well. I don't find other issue right now

@ueshin
Copy link
Collaborator Author

ueshin commented Sep 13, 2022

Thanks! merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants