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

Models action from v1 to v2 #101

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Models action from v1 to v2 #101

wants to merge 17 commits into from

Conversation

NRHelmi
Copy link
Contributor

@NRHelmi NRHelmi commented Sep 19, 2022

Use v2 protocol for model actions

@NRHelmi NRHelmi requested a review from torkins October 5, 2022 19:11
def list_models(ctx: Context, database: str, engine: str) -> List:
models = []
out_name = f'model{random.randint(0, sys.maxsize)}'
resp = exec(ctx, database, engine, f'def output:{out_name}[name] = rel:catalog:model(name, _)')
Copy link
Collaborator

Choose a reason for hiding this comment

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

why does this qualify the output relation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we qualify the output relation here to avoid collision with user predefined outputs

Copy link
Member

Choose a reason for hiding this comment

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

👍 The JS sdk does something similar, that makes sense to me.

cmd = f'def output:{out_name} = rel:catalog:model["{name}"]'
resp = exec(ctx, database, engine, cmd)
for result in resp.results:
if f'/:output/:{out_name}' in result['relationId']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's the reason why we generated a random output name then we filter out results based on that
users can install predefined output relations that could collapse with the get_model one

railib/api.py Outdated
@@ -879,6 +905,6 @@ def exec_async(
get_compute = get_engine # deprecated, use get_engine
list_computes = list_engines # deprecated, use list_engines
list_edb = list_edbs # deprecated, use list_edbs
delete_source = delete_model # deprecated, use delete_model
delete_source = delete_models # deprecated, use delete_model
Copy link
Collaborator

Choose a reason for hiding this comment

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

this changes the signature (i believe) .. so using this trick to support old names doesnt work, as its still breaking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh totally missed that, yep unfortunately this a breaking change, we have two options here:

  • keep supporting delete_source by adding an equivalent delete_model
  • deprecate delete_source and remove it from the api as it is also removed from other SDKs
    I think the first option makes more sense, @bradlo what do you think ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

finally added an equivalent delete_model

@NRHelmi NRHelmi requested a review from bradlo October 12, 2022 23:07
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.

3 participants