def test_anonymize_custom_simple_sqlalchemy_datasource(): name = "test_custom_simple_sqlalchemy_datasource" yaml_config = """ module_name: tests.data_context.fixtures.plugins.my_custom_simple_sqlalchemy_datasource_class class_name: MyCustomSimpleSqlalchemyDatasource connection_string: sqlite:///some_db.db name: some_name introspection: my_custom_datasource_name: data_asset_name_suffix: some_suffix """ config: CommentedMap = yaml.load(yaml_config) datasource_anonymizer = DatasourceAnonymizer(salt=CONSISTENT_SALT) anonymized_datasource = ( datasource_anonymizer.anonymize_simple_sqlalchemy_datasource( name=name, config=config)) assert anonymized_datasource == { "anonymized_name": "d9e0c5f761c6ea5e54000f8c10a1049b", "parent_class": "SimpleSqlalchemyDatasource", "anonymized_class": "aab66054e62007a9ac5afbcacedaf0d2", "anonymized_execution_engine": { "parent_class": "SqlAlchemyExecutionEngine" }, "anonymized_data_connectors": [{ "anonymized_name": "82b8b59e076789ac1476b2b745ebc268", "parent_class": "InferredAssetSqlDataConnector", }], }
def test_anonymize_simple_sqlalchemy_datasource(): name = "test_simple_sqlalchemy_datasource" yaml_config = f""" class_name: SimpleSqlalchemyDatasource connection_string: sqlite:///some_db.db introspection: whole_table_with_limits: sampling_method: _sample_using_limit sampling_kwargs: n: 10 """ config: CommentedMap = yaml.load(yaml_config) datasource_anonymizer = DatasourceAnonymizer(salt=CONSISTENT_SALT) anonymized_datasource = ( datasource_anonymizer.anonymize_simple_sqlalchemy_datasource( name=name, config=config)) assert anonymized_datasource == { "anonymized_name": "3be0aacd79b32e22a41949bf607b3e80", "parent_class": "SimpleSqlalchemyDatasource", "anonymized_execution_engine": { "parent_class": "SqlAlchemyExecutionEngine" }, "anonymized_data_connectors": [{ "anonymized_name": "d6b508db454c47ea40131b0a11415dd4", "parent_class": "InferredAssetSqlDataConnector", }], }