I am loading a dataset from BigQuery and after some transformations, I'd like to save the transformed DataFrame back into BigQuery. Is there a way of doing this?
This is how I am loading the data:
df = spark.read \
.format('bigquery') \
.option('table', 'publicdata.samples.shakespeare') \
.load()
Some transformations:
df_new = df.select("word")
And this I how I am trying to save the data as a new table into my project area:
df_new \
.write \
.mode('overwrite') \
.format('bigquery') \
.save('my_project.some_schema.df_new_table')
Is this even possible? Is there a way to save to BQ directly?
ps: I know this works but this is not exactly what I am looking for:
df_new \
.write \
.mode('overwrite') \
.format('csv') \
.save('gs://my_bucket/df_new.csv')
Thanks!