great_expectations icon indicating copy to clipboard operation
great_expectations copied to clipboard

TypeError: __init__() missing 1 required positional argument: 'data_asset_name' creating new suite

Open femibyte opened this issue 1 year ago • 6 comments

Describe the bug

I am following the steps of this tutorial:

https://docs.greatexpectations.io/docs/tutorials/getting_started/tutorial_overview/

When I try to create a new expectations suite by running great_expectations suite new

I get the following error:

  File "/Users/femibyte/local/anaconda3/lib/python3.8/site-packages/great_expectations/cli/toolkit.py", line 131, in get_default_expectation_suite_name
    suite_name = f"batch-{BatchRequest(**batch_request).id}"
TypeError: __init__() missing 1 required positional argument: 'data_asset_name'

after running the Select a datasource step:

To Reproduce

  1. Run great_expectations suite new
  2. At the Select a datasource step pick 1L

Expected behavior The code should not crash nut present the user with the next step: Which data asset

Environment (please complete the following information):

  • Operating System: MacOS
  • Great Expectations Version: great-expectations==0.15.12

Additional context Add any other context about the problem here.

femibyte avatar Jul 07 '22 19:07 femibyte

Hey @femibyte ! Thanks for reaching out. Are you able to provide the config for your datasource?

austiezr avatar Jul 08 '22 18:07 austiezr

Had a similar issue. Here's mine:

gcs_datasource:
    class_name: Datasource
    execution_engine:
      class_name: PandasExecutionEngine
      module_name: great_expectations.execution_engine
    data_connectors:
      default_runtime_data_connector_name:
        class_name: RuntimeDataConnector
        batch_identifiers:
          - default_identifier_name
        module_name: great_expectations.datasource.data_connector
      default_inferred_data_connector_name:
        default_regex:
          pattern: (.*)\.json
          group_names:
            - data_asset_name
        class_name: InferredAssetGCSDataConnector
        bucket_or_name: <bucket-name>
        module_name: great_expectations.datasource.data_connector
        prefix: <data-prefix>
    module_name: great_expectations.datasource

paschmaria avatar Jul 11 '22 01:07 paschmaria

Having similar issue as above and here is my config:

  getting_started_datasource:
    module_name: great_expectations.datasource
    data_connectors:
      default_inferred_data_connector_name:
        base_directory: data
        module_name: great_expectations.datasource.data_connector
        class_name: InferredAssetFilesystemDataConnector
        default_regex:
          group_names:
            - data_asset_name
          pattern: (.*)
      default_runtime_data_connector_name:
        assets:
          my_runtime_asset_name:
            module_name: great_expectations.datasource.data_connector.asset
            batch_identifiers:
              - runtime_batch_identifier_name
            class_name: Asset
        module_name: great_expectations.datasource.data_connector
        class_name: RuntimeDataConnector
    class_name: Datasource
    execution_engine:
      module_name: great_expectations.execution_engine
      class_name: PandasExecutionEngine```

vishalp27 avatar Jul 11 '22 07:07 vishalp27

Figured it out. I needed to clone the ge_tutorials directory, not create it.

femibyte avatar Jul 13 '22 08:07 femibyte

I don't think this needs to be closed though, I'm having the same issue and it has nothing to do with the ge_tutorials.

paschmaria avatar Jul 13 '22 08:07 paschmaria

I am also facing the same issue when I started using the ConfiguredAssetSqlDataConnector

Not able to create any new suites via CLI

 my_athena_hq:
    execution_engine:
      class_name: SqlAlchemyExecutionEngine
      connection_string: awsathena+rest....
      module_name: great_expectations.execution_engine
    data_connectors:
      default_configured_data_connector_name:
        assets:
          test_table_name:
            schema_name: test_schema_name
            module_name: great_expectations.datasource.data_connector.asset
            class_name: Asset
        module_name: great_expectations.datasource.data_connector
        class_name: ConfiguredAssetSqlDataConnector
    module_name: great_expectations.datasource
    class_name: Datasource

Great Expectations Version: great-expectations==0.15.16

Steps to reproduce:

  1. Create Datasource with the above-mentioned structure
my_datasource_rt:
    module_name: great_expectations.datasource
    execution_engine:
      class_name: SqlAlchemyExecutionEngine
      connection_string: awsathena+rest://:@athena......
      module_name: great_expectations.execution_engine
    data_connectors:
      default_runtime_data_connector_name:
        module_name: great_expectations.datasource.data_connector
        batch_identifiers:
          - default_identifier_name
        class_name: RuntimeDataConnector
    class_name: Datasource
  1. Create a new suite using CLI
  2. use "Interactively, with a sample batch of data"
  3. select datasource
  4. Getting this error with trace back
Traceback (most recent call last):
  File "C:\Users\SDHADWE\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\SDHADWE\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Sushrut\Repo\dl-data-qc\venv\Scripts\great_expectations.exe\__main__.py", line 7, in <module>
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\great_expectations\cli\cli.py", line 190, in main
    cli()
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\great_expectations\cli\suite.py", line 159, in suite_new
    batch_request=batch_request,
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\great_expectations\cli\suite.py", line 335, in _suite_new_workflow
    raise e
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\great_expectations\cli\suite.py", line 275, in _suite_new_workflow
    create_if_not_exist=True,
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\great_expectations\cli\toolkit.py", line 84, in get_or_create_expectation_suite
    batch_request=batch_request,
  File "c:\sushrut\repo\dl-data-qc\venv\lib\site-packages\great_expectations\cli\toolkit.py", line 131, in get_default_expectation_suite_name
    suite_name = f"batch-{BatchRequest(**batch_request).id}"
TypeError: __init__() missing 1 required positional argument: 'data_asset_name'

sushrut9898 avatar Aug 02 '22 09:08 sushrut9898

This only happens for me if I select s to search the list of tables in my database. If I select l to list them, then page through and type the index number it works.

How would you like to create your Expectation Suite?
    1. Manually, without interacting with a sample Batch of data (default)
    2. Interactively, with a sample Batch of data
    3. Automatically, using a Data Assistant
: 2

A batch of data is required to edit the suite - let's help you to specify it.

You have a list of 1,734 data assets. Would you like to list them [l] or search [s]?
: l

daviewales avatar Nov 09 '22 22:11 daviewales

Are there any updates on this one? It is happening for me as well. I have some weird repro steps to add:

  1. If I connect one datasource, then the great_expectations suite new command fails with the error mentioned here.
  2. When I connect a second one, I see both of them after selecting the way I want to create Expectations.
  3. Then it fails with the same error when selecting which datasource to use.

I came back after half a year of not using it and it was working fine before.

TheFreeRangeTester avatar Jan 11 '23 03:01 TheFreeRangeTester

Using python 3.7 instead of 3.10 solved the issue for me.

sdia avatar Feb 06 '23 14:02 sdia

Using python 3.7 instead of 3.10 solved the issue for me.

How do you do that?

lobvh avatar Feb 20 '23 20:02 lobvh

Using python 3.7 instead of 3.10 solved the issue for me.

This didn't change anything for me. Testing in a clean virtualenv (via pipx) and still the same error:

In the CLI a RuntimeDataConnector doesn't provide a data_asset_name and so whenever a BatchRequest is created there's a TypeError. If I recall correctly the data_asset_name can be absolutely anything for a RuntimeDataConnector

lukedyer-peak avatar Feb 21 '23 10:02 lukedyer-peak