import asyncio
from oleander_sdk import Oleander, SubmitSparkJobAndWaitOptions
async def main():
client = Oleander()
result = await client.query(
"SELECT * FROM oleander.default.flowers LIMIT 10"
)
for row in result.results.rows:
sepal_length, sepal_width = row[0], row[1]
# process each row ...
jobs = await client.list_spark_jobs()
print(jobs.scripts)
run = await client.submit_spark_job_and_wait(
SubmitSparkJobAndWaitOptions(
namespace="my-namespace",
name="daily-etl",
entrypoint="etl_pipeline.py",
)
)
if run.state != "COMPLETE":
raise Exception(f"Run {run.run_id} ended with state: {run.state}")
asyncio.run(main())