GitHub
07/30/2024, 4:09 AMFaker class, rather than just a faker instance
Pull request opened by Mac-lp3
I made a post in the discussions about my motivation for this.
Note the Faker lib provides two ways to accomplish this:
1. How it is done in this PR
from faker import Faker
Faker.seed('something')
faker = Faker()
The meltano mapper config would then look something like this:
stream_maps:
"*":
FirstName: Faker.seed('something') or fake.first_name() # note lib not instance
faker_config:
seed: 'something' # kind of redundant in this example, but hey, still works
1. Create your faker instance using the Faker.factory.
from faker.factory import Factory
Faker = Factory.create
fake = Faker()
fake.seed(0)
With this approach, the meltano mapper config would have looked something like this:
stream_maps:
"*":
FirstName: faker.seed('something') or fake.first_name() # note instance not lib
faker_config:
seed: 'something'
Option 2 is actually what the faker docs recommend.
Unfortunately, option 2 does not allow for multiple locales. Given that, I thought it best to go with option 1, rather than breaking other people's code.
---
📚 Documentation preview 📚: https://meltano-sdk--2578.org.readthedocs.build/en/2578/
meltano/sdk
GitHub Actions: External Tests
✅ 28 other checks have passed
28/29 successful checksGitHub
08/13/2024, 8:38 PM