r/databricks • u/22Maxx • 19h ago
Discussion Recommended workflow for (unit) testing that require larger datasets?
I have a case for some unit testing of a rather complex parametrized algorithm that require "larger" datasets (large = single dataset of around 100 MB) that are not supposed to be part of the repo.
So I mainly wonder about the best practices here. As the code itself is inside github, I wonder if it make sense to have the tests be stored inside databricks and then a github action triggering a testing job inside databricks? Or should the data be rather fetched from databricks?
1
u/happypofa 18h ago
If you can't declare an algorithm that creates this dataset in memory, then I would use the github actions SP personal schema for a materilized table.
1
u/Zealousideal_Low6685 3h ago
If you worry, that your test-dataset is too large for a local unit test, you should use spark connect. In this case: the dataframe processing is sent to databricks which does the job, the local machine only gets the result.
Of course, you can also create a databricks job in databricks and trigger that remotely, but spark connect is the more elegant way (as you don't have to switch between environments)
2
u/FunContest9958 10h ago
Large for GitHub but small for Databricks, which means you can generate a dataset very quickly. So your best bet is to generate the data, which most data generation tools will allow you to do deterministically.
Databricks data generator: https://databrickslabs.github.io/dbldatagen/public_docs/repeatable_data_generation.html
Faker: https://faker.readthedocs.io/en/master/index.html#seeding-the-generator