soma-smart / Fakelake

Generate massive fake datasets for your datalake, fast. By SOMA
https://soma-smart.github.io/Fakelake/
MIT License
17 stars 1 forks source link

Add string constant provider #38

Closed bhagenbourger closed 4 months ago

bhagenbourger commented 5 months ago

Partially solves #20

bhagenbourger commented 5 months ago

I only manage string type for the moment for string provider. I will do another PR for other types later.
Is this what you expected for constant provider?

bhagenbourger commented 5 months ago

Thank you for your feedback @vianneybacoup I think about your advice and I propose to split what I did into three providers:

What do you think about that?

vianneybacoup commented 5 months ago

Thank you for your feedback @vianneybacoup I think about your advice and I propose to split what I did into three providers:

  • ConstantStringProvider : a provider which accepts a single value and returns this value
  • ListStringProvider : a provider which accepts a list of values and returns a value randomly chosen
  • WeightedListStringProvider : a provider which accepts a weighted list of values and returns a value weighted randomly chosen

What do you think about that?

That's perfect. This should be purely on dev side. For the user, it will access those three providers with Constant.string (like what you did already), and the new_from_yaml function will return the correct one.

bhagenbourger commented 5 months ago

Hello @vianneybacoup I tried to improve my code following your comments, let me know if I need to do other improvements.

bhagenbourger commented 4 months ago

No worries, I didn't have time to fix that sooner. I just amended my commit with the fixes.