great_expectations icon indicating copy to clipboard operation
great_expectations copied to clipboard

Storing Validation Result to PostgreSQL

Open AlexNae opened this issue 2 years ago • 5 comments

Describe the bug

Issue related to storing Validation Result to PostgreSQL. I cannot create ge_validations_store tabel in the schema that I want.

To Reproduce Follow the steps here: https://docs.greatexpectations.io/docs/guides/setup/configuring_metadata_stores/how_to_configure_a_validation_result_store_to_postgresql/

Everything works fine except that the table can't be created in the schema that I want. When I try to specify "schema: <my_schema_name>", in config_variables.yml I get the following error: "create() got an unexpected keyword argument 'schema'" and the table is created in <my_schema_name> but it is not populated.

If I comment "schema: <my_schema_name>" the tabel is created somewhere else (in public schema in my case) and it is indeed populated.

Expected behavior Create ge_validations_store tabel in the schema that I want?

Environment (please complete the following information):

  • Operating System: Windows 10
  • Great Expectations Version: 0.13.42

Additional context Add any other context about the problem here.

AlexNae avatar Dec 13 '21 17:12 AlexNae

Hey @AlexNae thanks for opening up this issue. Would you mind providing us with your configuration (making sure to omit any sensitive details)? The contents of the great_expectations.yml file would be a great help here.

cdkini avatar Dec 15 '21 20:12 cdkini

config_version: 3.0

datasources:
  xdi_db:
    module_name: great_expectations.datasource
    credentials: ${xdi_db}
    class_name: SqlAlchemyDatasource
    data_asset_type:
      class_name: SqlAlchemyDataset
      module_name: great_expectations.dataset
  data__dir:
    module_name: great_expectations.datasource
    data_connectors:
      default_runtime_data_connector_name:
        module_name: great_expectations.datasource.data_connector
        batch_identifiers:
          - default_identifier_name
        class_name: RuntimeDataConnector
      default_inferred_data_connector_name:
        module_name: great_expectations.datasource.data_connector
        default_regex:
          group_names:
            - data_asset_name
          pattern: (.*)
        class_name: InferredAssetFilesystemDataConnector
        base_directory: ../data/
    class_name: Datasource
    execution_engine:
      module_name: great_expectations.execution_engine
      class_name: PandasExecutionEngine
  ge_v3:
    module_name: great_expectations.datasource
    data_connectors:
      default_runtime_data_connector_name:
        module_name: great_expectations.datasource.data_connector
        batch_identifiers:
          - default_identifier_name
        class_name: RuntimeDataConnector
      default_inferred_data_connector_name:
        module_name: great_expectations.datasource.data_connector
        class_name: InferredAssetSqlDataConnector
    class_name: Datasource
    execution_engine:
      module_name: great_expectations.execution_engine
      credentials:
        host: <>
        port: <>
        username: <>
        password: <>
        database: postgres
        drivername: postgresql
      class_name: SqlAlchemyExecutionEngine
config_variables_file_path: uncommitted/config_variables.yml

plugins_directory: plugins/

stores:
  validations_postgres_store:
    class_name: ValidationsStore
    store_backend:
      class_name: DatabaseStoreBackend
      credentials: ${xdi_db}

  expectations_store:
    class_name: ExpectationsStore
    store_backend:
      class_name: TupleFilesystemStoreBackend
      base_directory: expectations/

  validations_store:
    class_name: ValidationsStore
    store_backend:
      class_name: TupleFilesystemStoreBackend
      base_directory: uncommitted/validations/

  evaluation_parameter_store:
    class_name: EvaluationParameterStore

  checkpoint_store:
    class_name: CheckpointStore
    store_backend:
      class_name: TupleFilesystemStoreBackend
      suppress_store_backend_id: true
      base_directory: checkpoints/

expectations_store_name: expectations_store
validations_store_name: validations_postgres_store
evaluation_parameter_store_name: evaluation_parameter_store
checkpoint_store_name: checkpoint_store

data_docs_sites:
  local_site:
    class_name: SiteBuilder

    show_how_to_buttons: true
    store_backend:
      class_name: TupleFilesystemStoreBackend
      base_directory: uncommitted/data_docs/local_site/
    site_index_builder:
      class_name: DefaultSiteIndexBuilder

anonymous_usage_statistics:
  data_context_id: 6ccac32c-525d-4696-8436-d4920fdbd4fc
  enabled: true
notebooks:
concurrency:
  enabled: false

validation_operators:
    action_list_operator:
        class_name: ActionListValidationOperator
        action_list:
        - name: send_email_on_validation_result
          action:
            class_name: EmailAction
            notify_on: all
            notify_with:
            use_tls: False
            use_ssl: True
            renderer:
              module_name: great_expectations.render.renderer.email_renderer
              class_name: EmailRenderer
            smtp_address: ${smtp_address}
            smtp_port: ${smtp_port}
            sender_login: ${sender_login}
            sender_password: ${sender_password}
            sender_alias: ${sender_alias}
            receiver_emails: ${receiver_emails}

AlexNae avatar Dec 16 '21 11:12 AlexNae

I tried on datasources built with api v2 as well as with api v3

AlexNae avatar Dec 16 '21 11:12 AlexNae

@AlexNae apologies for the delayed response here.

My hunch is that the schema keyword is being passed in the wrong scope. believe this should be nested within a credentials YAML dict.

credentials:
  schema: {schema}

# or possibly this

credentials:
  query:
    schema: {schema}

cdkini avatar Jan 05 '22 14:01 cdkini

Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity.

It will be closed if no further activity occurs. Thank you for your contributions 🙇

github-actions[bot] avatar Aug 05 '22 02:08 github-actions[bot]