Skip to content

Instantly share code, notes, and snippets.

@jeanmidevacc
Created July 21, 2025 20:53
Show Gist options
  • Save jeanmidevacc/e2a229a053388c358e7ab68c78d42c17 to your computer and use it in GitHub Desktop.
Save jeanmidevacc/e2a229a053388c358e7ab68c78d42c17 to your computer and use it in GitHub Desktop.
Pyspark code to create volumen in databricks schemas
schemas = [] # Listo of the schemas to create the volume
volume_name = "" #name of you volume
for schema in schemas:
try:
spark.sql(f"CREATE VOLUME IF NOT EXISTS {schema}.{volume_name}")
print(f"Volume {volume_name} created or already exists.")
except Exception as e:
print(f"Error creating volume {volume_name}: {e}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment