Skip to content

Commit

Permalink
remove f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
madhur-ob committed Jun 26, 2024
1 parent 092bd04 commit 3707b8a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions metaflow/plugins/snowpark/snowpark_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,30 @@ def submit(self, name: str, spec, stage, compute_pool, external_integration):
self.root.compute_pools[compute_pool].fetch()

# upload the spec file to stage
result = self.session.file.put(snowpark_spec_file.name, f"@{stage}")
result = self.session.file.put(snowpark_spec_file.name, "@%s" % stage)

service_name = name.replace("-", "_")
external_access = (
f"EXTERNAL_ACCESS_INTEGRATIONS=({external_integration}) "
"EXTERNAL_ACCESS_INTEGRATIONS=(%s) " % external_integration
if external_integration
else ""
)

# cannot pass 'is_job' parameter using the API, thus we need to use SQL directly..
query = f"""
EXECUTE JOB SERVICE IN COMPUTE POOL {compute_pool}
NAME = {db}.{schema}.{service_name}
{external_access}
FROM @{stage} SPECIFICATION_FILE={result[0].target}
"""
EXECUTE JOB SERVICE IN COMPUTE POOL %s
NAME = %s.%s.%s
%s
FROM @%s SPECIFICATION_FILE=%s
""" % (
compute_pool,
db,
schema,
service_name,
external_access,
stage,
result[0].target,
)

async_job = self.session.sql(query).collect(block=False)
return async_job.query_id, service_name
Expand Down

0 comments on commit 3707b8a

Please sign in to comment.