Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Support generating fake data with future SDK version #215

Closed
ReubenFrankel opened this issue Feb 1, 2024 · 6 comments · Fixed by #218
Closed

feat: Support generating fake data with future SDK version #215

ReubenFrankel opened this issue Feb 1, 2024 · 6 comments · Fixed by #218

Comments

@ReubenFrankel
Copy link
Contributor

ReubenFrankel commented Feb 1, 2024

Now meltano/sdk#2170 has been merged and once the next version of the SDK is released, it would be great to bump the singer-sdk version used here with the faker extra to leverage the new feature.

@edgarrmondragon
Copy link
Member

@ReubenFrankel would you expect this package to enable the use of faker by default, i.e. depend directly on singer-sdk[faker], or would you prefer it to have its own extra?

I think I prefer on the former, since that makes this package more useful and it's presumably installed only once per project, unlike extractors.

@ReubenFrankel
Copy link
Contributor Author

@edgarrmondragon Yep, I think by default is the most useful.

edgarrmondragon added a commit that referenced this issue Feb 5, 2024
Closes #215

---------

Co-authored-by: Edgar Ramírez-Mondragón <edgarrm358@gmail.com>
@maxmarcon
Copy link

Hi! I'm resurrecting this because I have a question (I'm relatively new to meltano).

Ok I wanted to use stream_maps with faker with tap-postgres. However, apparently, tap-postgres doesn't support faker (I get an error saying that the "fake object is not defined").

As a workaround, I'm using meltano-map-transform instead. fake is defined, however when I want to set the seed following this example from the Meltano SDK docs:

   - name: meltano-map-transformer
      config:
          stream_maps:
              data_platform_raw-tbii_daily_gmv_nmv:
                  tb_channel_id: Faker.seed(0) or fake.pyint()

I get an error:

'Faker' is not defined for expression 'Faker.seed(0) or fake.pyint()'

Do you know why? Thanks

@ReubenFrankel
Copy link
Contributor Author

@maxmarcon Looks like that got added recently and will be included in the next SDK release. This plugin (and any other built with the SDK) will need to upgrade to the new version before what you are trying will work.

meltano/sdk@1333278

In the meantime, if you want to set a static seed, you can do this through faker_config.seed as in the docs example you linked, or in an expression with

   - name: meltano-map-transformer
      config:
          stream_maps:
              data_platform_raw-tbii_daily_gmv_nmv:
                  tb_channel_id: fake.seed_instance(0) and fake.pyint()

@maxmarcon
Copy link

maxmarcon commented Sep 2, 2024

Thanks @ReubenFrankel for the information. I was indeed able to find a workaround similar to the one you suggested:

fake.random.seed(self) or fake.pyint()

@edgarrmondragon
Copy link
Member

I'll try to cut a release of the SDK today, and should follow shortly with a version bump here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants