publish.features()

Creates Rasgo Features from a dict

Parameters

features_dict:dict:Dictionary to publish as Rasgo Features

{ "sourceTable": "mandatory DB.SCHEMA.TABLE where features are", "features": [ { "columnName": "mandatory_field_name_in_table", "displayName": "Optional Pretty Name", "dataType": "mandatory sql type", "description": "optional display text", "tags": [ "optional", "list of strings", "apply only to this feature" ], "attributes": [ { "key": "value"}, {"optional": "apply only to this features" } ] } ], "dimensions": [ { "columnName": "mandatory_field_name_in_table", "displayName": "Optional Pretty Name", "dataType": "mandatory sql type", "granularity": "mandatory noun ..." } ], "status": "Production | Sandbox", "tags": [ "optional", "list of strings", "apply to all features" ], "attributes": [ {"key": "value"}, {"optional": "apply to all features"} ], "script": "OptionalFile.py", "gitRepo": "Optional" }

Return Object

Rasgo FeatureSet

Sample Usage

Create new features from a dict

	features_dict = rasgo.prepare_feature_set_dict(600)
    print('My Dict:', features_dict)
	
	features_dict = {
        'sourceTable': 'pandas_by_DATE_YEAR_2021_02_05_00_42', 
        'features': [
            {
                'columnName': 'NEXT_MONTH', 
                'dataType': 'integer', 
                'displayName': 'PANDAS_NEXT_MONTH_2021_02_05_00_42', 
                'description': 'Feature that contains PANDAS_NEXT_MONTH_2021_02_05_00_42 data',
                'tags': ['test'],
                'attributes': [{'FeatureKey': 'FeatureValue'}]
            },
            {
                'columnName': 'NEXT_MONTH', 
                'dataType': 'integer', 
                'displayName': 'PANDAS_NEXT_MONTH_2021_02_05_00_42', 
                'description': 'Feature that contains PANDAS_NEXT_MONTH_2021_02_05_00_42 data'
            }
            ], 
        'dimensions': [
            {
                'columnName': 'YEAR', 
                'dataType': 'integer', 
                'granularity': 'test'
            }, 
            {
                'columnName': 'DATE', 
                'dataType': 'string', 
                'granularity': 'day'
            }
            ], 
        'tags': ['test', '02/05/2021', 'Pandas'],
        'attributes': [{'Key1': 'Value1'}],
        'status': 'Production'
    }
    features = rasgo.publish.features(features_dict)
    print(features)

Publish changes to an existing feature

Publish changes to all features in a FeatureSet

Columns in your DataSource table that are not referenced in either the "dimensions" or "features" list will be ignored

Best Practices / Tips

Last updated

Was this helpful?