From PySpark I am trying to execute a create table ... as select
statement in snowflake. This means I can't use something like:
(
spark.read.format('snowflake') \
.options(**sfOptions) \
.option("query", "create table ....") \
.load()
)
as that only supports select
statements.
In scala, one would use net.snowflake.spark.snowflake.Utils.runQuery
.
In PySpark, I can access this via spark.sparkContext._jvm.snowflake.spark.snowflake.Utils.runQuery
Which gets the job done and returns "JavaObject id=..." whatever that means.
Is there some more reasonable way how to run a query against snoflake from PySpark?
I've searched on the databricks website (e.g. here) but haven't found anything.
I guess I could use the python Snowflake connector instead...