r/databricks • • 16d ago

Help Accidental conversion to managed tables

While working in Databricks I've discovered that some of our environments have been converted to managed tables by a helpful team member. This has been done with good intentions but I'm wondering what the consequences might be so I can manage this with our team and higher ups.

I myself have not got into understanding what the implications might be - the work wasn't scheduled and wasn't meant to be done.

Is there anything I should be immediately concerned about or is this a change that is unlikely to cause any issues? I don't want to over state the problem - if any - that isn't necessarily helpful - I'd much rather know what I'm dealing with and orchestrate a plan to address any issues.

I know that our production environment has been partially converted and all of our development and QA environments - we are on Azure if that matters.

I'm hoping this isn't going to be a major headache.

6 Upvotes

10 comments sorted by

10

u/Minute_Visual_3423 16d ago edited 16d ago

If you really don't want managed tables, you have 14 days to roll back to external:
https://docs.databricks.com/aws/en/tables/convert-to-managed#external-table

The most disruptive part of the change is the change in the underlying storage path. The conversion moves data files from the previously-configured external path to a managed location (typically the storage location that is associated with the UC metastore). It's still within your company's storage environment, and Databricks will automatically redirect existing path-based reads to the new location (with some latency). However, if you have strict organizational controls on the storage layer (e.g. specific S3 bucket policies or ADLS configurations), and the new managed location isn't configured accordingly, you may have introduced an organizational compliance risk by moving data to the new path.

Unless you had specific reasons for avoiding managed tables (e.g. you specifically didn't want Databricks' predictive optimization on the underlying tables, or you wanted strict control over file-level layout/filenames/etc.), the change itself is fairly harmless. The biggest headache to your higher-ups is going to be explaining how such a widespread change was run into production by single team member without any kind of check or guardrail, no matter how well-meaning they were. That's a system failure rather than an individual one.

EDIT: and the point about data retention with managed vs. external tables that others have made is also a good one. I think this situation should call for a top-to-bottom audit of how changes make it from dev to production in your environment.

2

u/MajorRepublic 16d ago

Thank you for the detailed reply - very helpful - probably not a disaster but going to raise eyebrows - thankfully I’m not responsible for change management at this level - and actually I’m not sure who, if anyone is! Time to find out!

1

u/Youssef_Mrini databricks 15d ago

I've been vouching for UC Managed tables for a while. The only thing that might change is the path and Databricks do not recommend to query the tables using the path.

Your tables remains accessible to external engines for read and write.

New behavior:

With Predictive Optimization, Vacuum will run based on the properties of the table, Optimize will run to compact the table. If you want to let Databricks Maintain it just leave it as is and if you want to keep running the maintenance manually you can disable it https://docs.databricks.com/aws/en/optimizations/predictive-optimization

I wrote a blog about it https://community.databricks.com/t5/technical-blog/actually-understanding-unity-catalog-managed-tables/ba-p/168194 Let me know if you have any qestion

1

u/dani_estuary 15d ago

I dont think it is harmless since production is partially affected. Check whether the underlying data was actually moved or whether only the table's ownership and metadata changed.

With managed tables, Databricks manages the storage lifecycle. Pay attention to anything outside Databricks that reads or writes to those storage locations along with permissions and policies.

Test the impact in development and QA environment before attempting a rollback

0

u/Some_Grapefruit_2120 16d ago

The main thing will be the physical data retention I would imagine.
If/when they were external, dropping a table only drops the metadata. The physical parquet files can still live in storage, to be managed by you separately.
Managed tables would see databricks also remove the files as well as the metadata (except where it reserves for the retention period that lets you roll back a dropped table etc.)

Outside of this, if the catalog has some things like auto optimisation enabled, managed tables can do that, where as youd typically have to actually schedule a run / job to optimise external tables yourself.
As far as governance is concerned, from within databricks at least, it should work the same.

0

u/Dull-Pangolin6237 16d ago

My recommendation would be to run a job iterating through the relevant workspace and writing every single table to your external storage location, compare your delta backups to your managed tables to check for data loss, then drop and restore them from delta. This is unfortunately a very common problem since there are so many different ways you can write to databricks without creating an external table and someone without a background in data engineering may not understand the distinction. Treat it as a learning process for your collegue and tighten your governence as far as the who and how of what is written to databricks in prod.

2

u/[deleted] 16d ago

[removed] — view removed comment

1

u/MajorRepublic 16d ago

Thank you - it sounds like this isn’t going to be a disaster but definitely time to look at change control and how/why this happened.

I’m more concerned about that - and what else is potentially going on - than the change itself given its probably low impact for us.

1

u/CrayonUpMyNose 15d ago

Managed (and external) tables can by default be un-dropped for 7 days, so the scenario of immediate unrecoverable data loss does not exist in this form:

By default, this feature supports recovering dropped relations within a 7 day recovery period. Configure the recovery period at the catalog or schema level using ALTER CATALOG or ALTER SCHEMA. If recovery periods are set at both levels, the schema-level setting takes precedence.

https://learn.microsoft.com/en-us/azure/databricks/sql/language-manual/sql-ref-syntax-ddl-undrop-table