Skip to content

Conversation

@NRHelmi
Copy link
Contributor

@NRHelmi NRHelmi commented Sep 19, 2022

Use v2 protocol for model actions

@NRHelmi NRHelmi requested review from bradlo and larf311 September 20, 2022 04:19
@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
Contributor

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
Contributor

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
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
Contributor

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