SFDO-Tooling / Snowfakery

A tool for generating fake data that has relations between tables.
BSD 3-Clause "New" or "Revised" License
141 stars 32 forks source link

Error testing recipe with SFDC data query #1025

Open acrosman opened 5 months ago

acrosman commented 5 months ago

I'm trying to test a recipe that uses the Salesforce Query plugin: - plugin: snowfakery.standard_plugins.Salesforce.SalesforceQuery

Using the command: snowfakery .\datasets\my.recipe.yml --plugin-option org_name myOrg

This results in a python error: ModuleNotFoundError: No module named 'cumulusci'

Running on: Windows 11 Snowfakery and CCI were installed with Pipx

> snowfakery --version
snowfakery version 3.6.1
You have the latest version of Snowfakery

Program: C:\Users\acros\.local\pipx\venvs\snowfakery\Lib\site-packages\snowfakery\cli.py
Python: 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
Executable: C:\Users\acros\.local\pipx\venvs\snowfakery\Scripts\python.exe
Installation: Properly installed
> cci --version
CumulusCI version: 3.85.0 (c:\users\acros\.local\bin\cci)
Python version: 3.11.4 (C:\Users\acros\.local\pipx\venvs\cumulusci\Scripts\python.exe)

WARNING: Long path support is not enabled. This can lead to errors with some
tasks. Your administrator will need to activate the "Enable Win32 long paths"
group policy, or set LongPathsEnabled to 1 in the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem.

You have the latest version of CumulusCI ⛅

See the latest CumulusCI Release Notes: https://github.com/SFDO-Tooling/CumulusCI/releases/tag/v3.85.0

Minimal testing recipe:

- plugin: snowfakery.standard_plugins.Salesforce.SalesforceQuery

- object: Contact
  fields:
    LastName:
      fake: LastName
    AccountId:
      SalesforceQuery.random_record:
        from: Account
acrosman commented 5 months ago

Same results on a Mac OS 13 and Snowfakery 3.6.2

$ snowfakery queryTest.recipe.yml --plugin-option org_name otter --debug-internals
Traceback (most recent call last):
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/standard_plugins/Salesforce.py", line 183, in _get_CliRuntime
    from cumulusci.cli.runtime import CliRuntime
ModuleNotFoundError: No module named 'cumulusci'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime_object_model.py", line 464, in generate_value
    return self.definition.render(context)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime_object_model.py", line 424, in render
    value = evaluate_function(func, self.args, self.kwargs, context)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime.py", line 676, in evaluate_function
    return func(*args, **kwargs)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/standard_plugins/Salesforce.py", line 400, in random_record
    count_result = self._sf_connection.query(count_query)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/standard_plugins/Salesforce.py", line 75, in query
    return self.sf.query(*args, **kwargs)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/standard_plugins/Salesforce.py", line 63, in sf
    project_config, org_config = self.get_project_config_and_org_config()
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/standard_plugins/Salesforce.py", line 168, in get_project_config_and_org_config
    project_config, org_config = self._get_org_info_from_cli_keychain()
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/standard_plugins/Salesforce.py", line 174, in _get_org_info_from_cli_keychain
    runtime = self._get_CliRuntime()  # from CCI CliRuntime
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/standard_plugins/Salesforce.py", line 188, in _get_CliRuntime
    raise DataGenError("CumulusCI Runtime cannot be loaded", *e.args)
snowfakery.data_gen_exceptions.DataGenError: CumulusCI Runtime cannot be loaded
 in No module named 'cumulusci'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/acrosman/.local/bin/snowfakery", line 8, in <module>
    sys.exit(main())
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/cli.py", line 296, in main
    generate_cli.main(prog_name="snowfakery")
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/cli.py", line 250, in generate_cli
    raise e
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/cli.py", line 230, in generate_cli
    generate_data(
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/api.py", line 185, in generate_data
    summary = generate(
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator.py", line 192, in generate
    runtime_context = interpreter.execute()
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime.py", line 387, in execute
    self.loop_over_templates_until_finished(self.continuing)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime.py", line 406, in loop_over_templates_until_finished
    self.loop_over_templates_once(self.statements, continuing)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime.py", line 415, in loop_over_templates_once
    statement.execute(self, self.current_context, continuing)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime_object_model.py", line 307, in execute
    self.generate_rows(interp.output_stream, interp.current_context)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime_object_model.py", line 188, in generate_rows
    rc = self._generate_row(output_stream, context, i)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime_object_model.py", line 260, in _generate_row
    self._generate_fields(context, row)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime_object_model.py", line 279, in _generate_fields
    value = field.generate_value(context)
  File "/Users/acrosman/.local/pipx/venvs/snowfakery/lib/python3.9/site-packages/snowfakery/data_generator_runtime_object_model.py", line 466, in generate_value
    raise fix_exception(
snowfakery.data_gen_exceptions.DataGenError: Problem rendering field AccountId:
 CumulusCI Runtime cannot be loaded
 near No module named 'cumulusci':7