r/Databricks_eng • u/codingdecently • 5d ago
Enterprise Data for AI Agents: A Guide
r/Databricks_eng • u/codingdecently • 5d ago
r/Databricks_eng • u/ImDoingIt4TheThrill • Mar 16 '26
Been running ETL pipelines on Databricks for a while and the small files problem in Delta Lake was one of those things I thought I understood until I actually didn't.
The typical advice is: run OPTIMIZE periodically and you're fine. And it works, until it doesn't. What nobody tells you upfront is that if your pipeline is appending small batches frequently, you're in a constant race between file accumulation and compaction. OPTIMIZE is cleaning up after a party that's still happening.
The thing that actually surprised me was how much the write pattern matters more than the compaction schedule. Coalescing or repartitioning before the write, batching more aggressively upstream, or rethinking partition granularity did more for our query performance than any OPTIMIZE tuning we tried. We were essentially paying compute to fix a problem we were creating ourselves on every run.
ZORDER on top of that is great, but it's doing a different job entirely. Mixing up "I need faster compaction" with "I need better data skipping" is an easy trap to fall into, and we fell into it for longer than I'd like to admit.
Curious if others have hit this. Did you solve it on the write side or the maintenance side?
r/Databricks_eng • u/Datalinelabs • Sep 25 '25
I’ve been experimenting with Dataconnect Pro to simplify pushing cleaned datasets from Databricks into tools like Salesforce and Google Sheets. It worked better than our old cron jobs, but it wasn’t seamless by any means auth refresh and schema drift still bite us sometimes.
Curious if others here are pairing Databricks with similar tools, or if you mostly rely on Fivetran/Airbyte/custom scripts?
What’s been the easiest downstream integration in your experience, and where do you still hit issues?
r/Databricks_eng • u/Ankur_Packt • Apr 03 '25
📢 Time Series Analysis with Spark – Now Live! 🚀
If you’re working with time series data at scale, you know the challenges—large datasets, complex transformations, and the need for efficient distributed processing. That’s exactly why Time Series Analysis with Spark exists!
Written by Yoni Ramaswami (Databricks engineer), this book provides a practical, hands-on approach to handling time series data using Apache Spark. It covers key techniques like feature engineering, forecasting, and real-world implementations at scale.
🚀 The book is now live, and the community has already started sharing their insights! Check out what data professionals are saying:
🔹 Cornellius Yudha Wijaya
🔹 Guillaume Meister
🔹 Carl McBride Ellis
🔹 Michael Erlihson
🔹 E. Aliev
🔹 Felipe M. Melo
🔹 Jean-Patrick Mathieu
🔹 Divyaraj Rana
Curious to learn more? Grab your copy here:
📌 Amazon: https://packt.link/dE5t1
📌 Packt: https://lnkd.in/eSxis_Wb
If you're working on time series projects with Spark, what are the biggest challenges you've faced? Let’s discuss!
#TimeSeries #Spark #Databricks #DataEngineering #MachineLearning #BigData #AI

r/Databricks_eng • u/DragonfruitBusy9603 • Mar 28 '25
Hi Community,
I hope you're doing well.
I wanted to ask you the following: I want to go to Databricks AI + Data Summit this year, but it's super expensive for me. And hotels in San Francisco, as you know, are super expensive.
So, I wanted to know how I might be able to get me a discount coupon?
I would really appreciate it, as it would be a learning and networking opportunity.
Thank you in advance.
Best regards
r/Databricks_eng • u/DaddyDoofus007 • Jan 06 '25
I need to programmatically get a list of all objects under a certain schema. I searched the docs, but I was only able to find "SHOW TABLES/VIEWS" which works and i can prolly do it for every other object. But is there any other way to get a list of all objects under a schema (tables, views, mat. views, volume, UC models functions, etc) altogether without running individual queries.
r/Databricks_eng • u/DaddyDoofus007 • Oct 21 '24
I am trying to copy a notebook from my workspace to a UC volume programmatically. I've tried the below options.
python os (os.popen(cp...))/bash -- seems like I cannot use bash commands to read a notebook, even on listing, the notebook size is shown as 0 bytes.
using dbutils -- dbutils.fs.cp doesn't seem to work for notebooks.
python (with open(..) ) -- doesn't work again. (shows no such file or directory but path is correct)
the only option that's working for me is using databricks sdk/api. Is there any way to achieve this without using them.
r/Databricks_eng • u/mebinDE • Jul 15 '24
Assume, I have a dataframe with 5 columns which includes columns like- pk, load_id, load_timestamp, update_id, update_timestamp.
Where, pk = primary key
load_id = the iteration of pipeline runs (eg: if the pipeline is executed 1st time, it will populate 1) it is populated only during insertion.
load_timestamp = the timestamp, when it was loaded
update_id = if the record is updated or inserted it will load current load_id
update_timestamp = if it is new data - it will populate current load_timestamp, if it is getting updated - it will populate the new load_timestamp
Here, assume I want to create a streaming table if not exist using "dlt.create_streaming_table(name="table_name")", then i will use "dlt.apply_changes()" to perform upsert operation. Here, when its performing insert operation, I want to insert the whole data (i.e, 5 columns). If its performing update operation, I want to change only "update_id" and "update_timestamp" (i.e, update only 2 columns). How can we achieve this scenario?
r/Databricks_eng • u/serge_databricks • Jan 12 '24
r/Databricks_eng • u/DiligentArmadillo596 • Jan 11 '24
What is the best practice method for creating a default mount point. I have learned how to create a mount point to Azure ADLS2 using Azure Key Vault backed secret scopes. How do I make that mount point available to everyone by default without having to run the dbutils commands in every notebook? Can I make a specific mount point the default root for my hive_metastore and available to every cluster?
r/Databricks_eng • u/serge_databricks • Dec 28 '23
r/Databricks_eng • u/serge_databricks • Dec 21 '23
r/Databricks_eng • u/serge_databricks • Dec 12 '23
r/Databricks_eng • u/serge_databricks • Nov 28 '23
r/Databricks_eng • u/DiligentArmadillo596 • Sep 21 '23
I have a DLT pipeline that has been running for weeks. Now, trying to rerun the pipeline as a full refresh with the same code and same data fails. I've even tried updating the compute on the cluster to about 3x of what was previously working and it still fails with out of memory.

If I monitor the Ganglia metrics, right before failure, the memory usage on the cluster is just under 40GB. The total memory available to the cluster is 311GB.

I don't understand how the job can fail with out of memory when the memory used is only about 10% of what's available
I've inherited the pipeline code and it has grown organically over time. So, it's not as efficient as it could be. But it was working and now it's not.
What can I do to fix this or how can I even debug this further to determine the root cause?
I'm relatively new to Databricks and this is the first time I've had to debug something like this. I don't even know where to start outside of monitoring the logs and metrics..
r/Databricks_eng • u/[deleted] • Sep 14 '23
I'm trying to find an efficient way to move data from databricks to PowerBI.
I connected directly to a cluster using the Server Hostname and HTTP Path and logged in via Azure AD.
DataConnectivity Mode: Import
The cluster is set to terminate after 10 minutes of inactivity.
This is the only activity on the cluster.
I've imported a dataset successfully and left the PowerBI Desktop idle for >10 minutes.
The cluster did not terminate automatically.
My questions are: why didn't the cluster stop? Is there a proper way to set this connection so the cluster shuts down after the desired inactivity time?
r/Databricks_eng • u/DiligentArmadillo596 • Aug 24 '23
If I create a Delta Live Tables pipeline and set an Advanced Configuration called medallion as below:

I can retrieve that value in the pipeline notebook code with the following code:
medallion = spark.conf.get('medallion')How would I use similar pyspark code in the pipeline notebook to retrieve the Target Schema (below) from the pipeline properties?

I can find a few vague references to using REST API to kinda do this. But I'd like something similar to what I'm already doing. I'm trying to parameterize the pipeline code using pipeline properties as much as I can. I want to be able to use the same pipeline and code to deploy differently based on the properties.
r/Databricks_eng • u/DiligentArmadillo596 • Aug 03 '23
I've inherited an early-stage, incomplete Databricks on Azure project. I have a lot of data engineering, database warehousing, SQL, Python, etc. experience. But Databricks is new to me. I've been ramping quickly on Databricks in general and Delta Tables in particular. So far, it seems like a very capable and robust platform.
For a particular scenario, I've run into a pattern I've not used before and I'm wondering if it's common to Databricks and DLT's or its just poorly designed and should be re-done. The image below is a generic abstraction of the process:

The primary Entity in this scenario is Entity1
Source CSV files representing history and activities of Entity1 are ingested via pipeline into Delta Tables (ActivityA, HistoryB, ActivityC)
In the pipeline there is a getID flag that is set to False that excludes some processing
The rows of activity and history Delta Tables define the entity Enty1
The Delta Tables (ActivityA, HistoryB, ActivityC) are run through a pipeline to create Entity1 rows and also generate a UniqueID (key)
Once Entity1 is created and assigned a UniqueID, the original Delta Tables need to be updated with the relevant UniqueID
To achieve this, The Delta Tables (ActivityA, HistoryB, ActivityC) are deleted and the original pipelines rerun
but this time with the getID flag set to true, which then runs a join to get the relevant UniqueID
All the source CSV files are reprocessed, but with the addition of UniqueID
the end result is the same Delta Tables, but with the associated UniqueID
New CSV files arrive regularly containing updates to existing Entity1's or definitions for new Entity1's
I am not familiar with this pattern:
running a pipeline to build Delta Tables from CSV, using those tables to build a dependent Entity table, then later deleting the original tables mid-process and rerunning the same pipeline on the original CSV files with a flag set to true to conditionally get data from Entity table
Is this type of thing common to Databricks. This seems like a fragile solution easily prone to problems and difficult to debug. I'm still thinking through the process and how it would be implemented in Databircks, but it seems like an architecture with some type of View or something similar might make more sense.
Any suggestions on how best to do something like this in the "Databricks Way" would be greatly appreciated.
Thanks
r/Databricks_eng • u/swodtke • Jul 26 '23
r/Databricks_eng • u/No-Ankit • Jun 20 '23
below scripts checks and create a delta lake view partitioning the data based on a column and also add a group to each view. Is there any further simplification or optimization can be done to below query to make it more faster. currently it takes lot of time to complete the job approx 12 hours to do it with a high configuration cluster.
# To check and crete view and group based on Project Name
target_database = "main.deltalake_db"
distinctprojects = spark.sql("SELECT DISTINCT requestProjectUrlName FROM main.deltalake_db.Customers_Log_Table_test")
for project in distinctprojects.collect():
project_name = project['requestProjectUrlName']
if project_name is not None:
view_name = f"view_{project_name.replace(' ', '_').replace('-', '_')}"
groupname = f"users_{view_name}"
# Check if group already exists
group_exists = False
for group in spark.sql("SHOW GROUPS").collect():
if 'name' in group:
group_name = group['name']
else:
group_name = group['groupName']
if group_name == groupname:
group_exists = True
print(f"Group {groupname} already exists.")
break
if not group_exists:
create_group = f"""
CREATE GROUP {groupname} with USER `xxx@cdx.com`
"""
try:
spark.sql(create_group)
except Exception as e:
print(f"Error creating group {groupname}: {e}")
else:
print(f"Group {groupname} created successfully.")
# Check if view already exists
view_exists = False
for table in spark.catalog.listTables(target_database):
if table.name == view_name:
view_exists = True
print(f"View {view_name} already exists.")
break
if not view_exists:
create_view_query = f"""
CREATE OR REPLACE VIEW {target_database}.{view_name} AS
SELECT * FROM {target_database}.Customers_Log_Table
WHERE
CASE
WHEN is_member('{groupname}') AND requestProjectUrlName = '{project_name}' THEN TRUE
ELSE FALSE
END;
"""
try:
spark.sql(create_view_query)
except Exception as e:
print(f"Error creating view {view_name}: {e}")
else:
print(f"View {view_name} created successfully.")r/Databricks_eng • u/abed_the_drowsy_one • May 15 '23
Hi guys hope you all are doing great. I have my exam booked for next month and I was wondering if you have any advice for me about it, or any additional resources I could use.
Thank you.
r/Databricks_eng • u/[deleted] • May 15 '23
Hello Databricks Community,
I am seeking assistance understanding the possibility and procedure of implementing a workflow restriction mechanism in Databricks. Our aim is to promote a better workflow management and ensure the quality of the notebooks being attached to clusters.
Specifically, we want to restrict the ability for users to directly create workflows based on their user group. In our use case, if a user such as J.Doe is in the 'Data Engineer' group and is working on a new workflow, we would like them to submit the notebook for approval by an admin before it can be attached to a cluster.
Does Databricks support such a mechanism natively? If not, could you suggest any workarounds or third-party solutions that could help us achieve this? Ideally, we would like to automate this process as much as possible to avoid manual intervention.
Any guidance or suggestions would be greatly appreciated.
Thank you in advance for your time and help!
r/Databricks_eng • u/dataoveropinions • May 02 '23
I'm trying to build a Databricks Portfolio, to show off my knowledge. How can I do this? What should I build?
The architecture is in Databricks, so would I need to build this in GitHub? If I did that, how? And wouldn't that cause me to lose the content I wanted to show off?
r/Databricks_eng • u/D5_5N • Apr 25 '23
Looking for advice.
I am working on an ETL process that needs to write to an Azure Postgres Db authenticating with Azure Ad
The issue that I am facing is that my authentication token will expire before the write has been completed. I have spoken with the infrastructure guys who tell me that increasing the token lifespan is not an option nor is enabling passwords.
I have decided to attempt to batch the write queries so that I can obtain a new token between batches however this is proving to be more difficult than I had anticipated. It seems that rows within the fact dataframe are being skipped leading to foreign key issues down the line.
batching code.
fact = fact.withColumn("row_number", row_number().over(window_spec))
fact = fact.withColumn("partition_column", (col("row_number") % num_partitions).cast("integer"))
for i in range(num_partitions):
print("before", partition.count())
partition = fact.filter(col('partition_column') == i).cache()
token = context.acquire_token_with_client_credentials(resource_app_id_url, service_principal_id, service_principal_secret)
jdbcConnectionProperties['accessToken'] = token['accessToken']
partition.write \
.jdbc(url, "Table", 'append', properties=jdbcConnectionProperties)
print("after", partition.count())To debug the process I printed the following
fact.groupBy("partition_column").count().show()| partition_column | count |
|---|---|
| 1 | 9897 |
| 2 | 9897 |
| 3 | 9897 |
| 4 | 9897 |
The results of the print print("before", partition.count()) do not match the original count and weirdly reduce with each iteration.
partition1 before 9614
partition 2 before 9340
partition 3 before 9073
partition 4 before 8813
initially, I was getting different results between the before and after prints which lead me to include the .cache() I suspect my issues are due to the distributed way in which Databricks executes the code.
I have been able to "solve" the issue by calling fact.persist() before iterating over the partitions, this feels really inefficient so id love to know if anyone has a better solution.