cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Delete a file from GCS folder

MBV3
New Contributor III

What is the best way to delete files from the gcp bucket inside spark job?

1 REPLY 1

Unforgiven
Valued Contributor III

@M Baig​ 

yes you need just to create service account for databricks and than assign storage admin role to bucket. After that you can mount GCS standard way:

  1. bucket_name = "<bucket-name>"
  2. mount_name = "<mount-name>"
  3. dbutils.fs.mount("gs://%s" % bucket_name, "/mnt/%s" % mount_name)
  4. display(dbutils.fs.ls("/mnt/%s" % mount_name))

here link for ur refer before process, hope some info help on this case

https://docs.gcp.databricks.com/external-data/gcs.html

cheer

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now