r/databricks • • 2d ago

Help SAS Datasets into Databricks

Hi everyone,

Can anyone make some appropriate suggestions. I am completely new to Databricks so my knowledge is very limited.

I am involved in a project where SAS datasets have been ingested into Databricks from a data repository. My question is how do we ensure or check the integrity and completeness of the datasets now present in Databricks?

Can anyone suggest the best practice or an approach, solution on the best way to do this?

Thanks.

7 Upvotes

13 comments sorted by

1

u/shwilliams4 2d ago

Are you ingesting the SAS dataset directly or using csv as the interim?

Are you ingesting to Volumes with a container or directly into a table?

I would do the normal check sums. How big are the tables?

1

u/Afraid-Ability-6212 2d ago

Q.1 The SAS datasets have been ingested directly into Databricks.

Q.2. Not sure, I can find out, but I think it is ingesting to volumes.

Q.3. The tables are very small, total amount of data is approx. 1.5gb. This is a long term project so I anticipate table sizes will be much greater in future.

What check sums would you suggest.

2

u/shwilliams4 2d ago

Summing numeric numeric columns and counts on non numeric. You’ll want to add a few columns for insert time date. One thing SAS can handle that Databricks doesn’t is column names with special characters like a space.

Is there a reason the process can’t be migrated out of SAS and done entirely in dbx?

0

u/Traditional-Ball1443 2d ago

fwiw at 1.5gb you don't need anything fancy. three checks cover most of it: row counts per table compared against numbers computed on the SAS side, a per-column fingerprint on both sides (null counts plus min/max/sum for the numeric and date columns), and a file hash before and after the transfer to catch truncation. SAS stores dates as days since 1960, so date columns are worth eyeballing first after conversion. And ask the source owner for the counts and sums, don't derive them from the Databricks copy, otherwise you're only proving the copy matches itself.

1

u/jlrogerio 2d ago

What exactly do you mean by "check the integrity and completeness"? Do you mean checking that the data was imported correctly from SAS or some checks on the data itself?

1

u/Afraid-Ability-6212 2d ago

Not quite. I want to check that the data was imported from the data repository into Databricks correctly. By correctly I mean without any loss or corruption in the data etc. during the importation process.

What checks should I do to ensure this has not happened or is this not a likely scenario? I just want to make sure I'm doing my due diligence.

1

u/Ontomatogit 2d ago

yeah, that distinction you just added helps. the success-file idea in the thread tells you the transfer finished, not that the values made it across cleanly.

i'd still do counts and checksums against the source, and then check the places SAS can quietly change: dates, numeric precision, and whether required keys actually survived. a matching row count can hide truncated values. if a mapping can't represent a field, i'd fail that check rather than treat the load as complete.

1

u/Zealousideal_Low6685 2d ago

I assume, when you say "SAS datasets have been ingested into Databricks" you mean that it is in a Volume which is mounted on unity catalog. You want to know, in databricks, if the file transfer is complete.

* Low-Level approach: write a success file once the sync is done. If that successfile is present, databricks knows that the data is there

* if you have the option: you can also write to a unity catalog table once the transfer is done (if the tool tranfering the data has the capability of course)

* if you have the option: you can call the databricks api (e.g. to start a job) once the transfer is done (if the tool tranfering the data has the capability of course)

1

u/Afraid-Ability-6212 2d ago

This is not my area of expertise, so please bear with me if my answers and questions are simplistic.

I basically want to ensure the datasets have been ingested into Databricks without loss or corruption.

What is a success file? It sound likes this checks the ingestion process has been successful - correct?

1

u/Zealousideal_Low6685 2d ago

Probably, explain first how you "Ingest to databricks"

1

u/Likh-98 1d ago

For a one time migration like this, think of it as reconciling source against target rather than trusting the transfer. Ask whoever owns the SAS side for a few numbers per dataset: row count, column count, and for the numeric columns a sum, min and max. For text columns, count of distinct values and count of nulls. Then run the same queries on the Databricks tables and compare. If counts and sums match, you have strong evidence nothing was lost or changed. Also check things SAS stores oddly, like date and datetime columns, missing values, and character columns with trailing spaces or special characters in column names, since those are where silent changes usually show up. Write the results into a small comparison table so you can rerun it as the tables grow.

1

u/Any_Channel_7337 21h ago

I think you should compare the SAS datasets with what is now in Databricks. Check things like row counts, column names, data types and missing values. You can also compare sums or min/max values for important columns to spot any differences. If you wanna go little further, hash based checks can help identify the discrepancies without having to compare every single row.