-
Notifications
You must be signed in to change notification settings - Fork 55
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
NA+SPCS setup script modifications PoC #1827
base: main
Are you sure you want to change the base?
Conversation
655992c
to
d65286a
Compare
return dedent( | ||
f"""\ | ||
-- Begin generated SPCS services, this section is managed by the Snowflake CLI | ||
create schema if not exists _spcs_generation; | ||
|
||
create or replace procedure {name}(privileges array) | ||
returns string | ||
as $$ | ||
begin | ||
{f'call {existing_grant_callback}(privileges);' if existing_grant_callback else ''} | ||
if (array_contains('CREATE COMPUTE POOL'::variant, privileges)) then | ||
create compute pool if not exists {service.compute_pool} | ||
min_nodes = {service.min_nodes} | ||
max_nodes = {service.max_nodes} | ||
instance_family = {service.instance_family}; | ||
end if; | ||
if (array_contains('BIND SERVICE ENDPOINT'::variant, privileges)) then | ||
create service if not exists _spcs_generation.{service.fqn.name} | ||
in compute pool {service.compute_pool} | ||
from specification_file = '{service.specification_file}'; | ||
end if; | ||
return 'done'; | ||
end; | ||
$$; | ||
|
||
create application role if not exists _spcs_generation_role; | ||
grant usage on procedure {name}(array) to application role _spcs_generation_role; | ||
|
||
-- End generated SPCS services | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you see a way to reuse the same logic from SpcsEntity.deploy()
or ServiceEntity.deploy()
once it will be implemented?
return bundle_map | ||
|
||
def _inject_spcs(self, spcs_services: list[ServiceEntity]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay as a PoC, but we probably need to be more careful when we auto-modify the manifest and setup script
services: list[str] = Field( | ||
title="List of Snowpark Container Service entity IDs to integrate into this application package", | ||
default=[], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure there's a real problem here, but by omitting the proposed children
field we lose the ability to order these internal dependencies
d65286a
to
2f3309e
Compare
2f3309e
to
01440bd
Compare
Pre-review checklist
Changes description
snow app run
snow app open