Skip to main content

Athena

Module athena

Certified

Important Capabilities

CapabilityStatusNotes
Data ProfilingOptionally enabled via configuration. Profiling uses sql queries on whole table which can be expensive operation.
DescriptionsEnabled by default
DomainsSupported via the domain config field
Platform InstanceEnabled by default
Table-Level LineageOptionally enabled via configuration

This plugin supports extracting the following metadata from Athena

  • Tables, schemas etc.
  • Profiling when enabled.
note

Athena source only works with python 3.7+.

Install the Plugin

pip install 'acryl-datahub[athena]'

Quickstart Recipe

Check out the following recipe to get started with ingestion! See below for full configuration options.

For general pointers on writing and running a recipe, see our main recipe guide

source:
type: athena
config:
# Coordinates
aws_region: my_aws_region
work_group: primary

# Options
s3_staging_dir: "s3://my_staging_athena_results_bucket/results/"

sink:
# sink configs

Config Details

Note that a . is used to denote nested fields in the YAML recipe.

View All Configuration Options
FieldRequiredTypeDescriptionDefault
envstringThe environment that all assets produced by this connector belong toPROD
platformstringThe platform that this source connects toNone
platform_instancestringThe instance of the platform that all assets produced by this recipe belong toNone
optionsDict{}
include_viewsbooleanFalse
include_tablesbooleanWhether tables should be ingested.True
schemestringawsathena+rest
usernamestringUsername credential. If not specified, detected with boto3 rules. See https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.htmlNone
passwordstringSame detection scheme as usernameNone
databasestringThe athena database to ingest from. If not set it will be autodetectedNone
aws_regionstringAws region where your Athena database is locatedNone
s3_staging_dirstringStaging s3 location where the Athena query results will be storedNone
work_groupstringThe name of your Amazon Athena WorkgroupsNone
stateful_ingestionSQLAlchemyStatefulIngestionConfig (see below for fields)
stateful_ingestion.enabledbooleanThe type of the ingestion state provider registered with datahub.False
stateful_ingestion.max_checkpoint_state_sizeintegerThe maximum size of the checkpoint state in bytes. Default is 16MB16777216
stateful_ingestion.state_providerDynamicTypedStateProviderConfig (see below for fields)The ingestion state provider configuration.
stateful_ingestion.state_provider.typestringThe type of the state provider to use. For DataHub use datahubNone
stateful_ingestion.state_provider.configGeneric dictThe configuration required for initializing the state provider. Default: The datahub_api config if set at pipeline level. Otherwise, the default DatahubClientConfig. See the defaults (https://github.com/datahub-project/datahub/blob/master/metadata-ingestion/src/datahub/ingestion/graph/client.py#L19).None
stateful_ingestion.ignore_old_statebooleanIf set to True, ignores the previous checkpoint state.False
stateful_ingestion.ignore_new_statebooleanIf set to True, ignores the current checkpoint state.False
stateful_ingestion.remove_stale_metadatabooleanSoft-deletes the tables and views that were found in the last successful run but missing in the current run with stateful_ingestion enabled.True
schema_patternAllowDenyPattern (see below for fields)regex patterns for schemas to filter in ingestion.{'allow': ['.*'], 'deny': [], 'ignoreCase': True, 'alphabet': '[A-Za-z0-9 _.-]'}
schema_pattern.allowArray of stringList of regex patterns for process groups to include in ingestion['.*']
schema_pattern.denyArray of stringList of regex patterns for process groups to exclude from ingestion.[]
schema_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
schema_pattern.alphabetstringAllowed alphabets pattern[A-Za-z0-9 _.-]
table_patternAllowDenyPattern (see below for fields)regex patterns for tables to filter in ingestion.{'allow': ['.*'], 'deny': [], 'ignoreCase': True, 'alphabet': '[A-Za-z0-9 _.-]'}
table_pattern.allowArray of stringList of regex patterns for process groups to include in ingestion['.*']
table_pattern.denyArray of stringList of regex patterns for process groups to exclude from ingestion.[]
table_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
table_pattern.alphabetstringAllowed alphabets pattern[A-Za-z0-9 _.-]
view_patternAllowDenyPattern (see below for fields)regex patterns for views to filter in ingestion.{'allow': ['.*'], 'deny': [], 'ignoreCase': True, 'alphabet': '[A-Za-z0-9 _.-]'}
view_pattern.allowArray of stringList of regex patterns for process groups to include in ingestion['.*']
view_pattern.denyArray of stringList of regex patterns for process groups to exclude from ingestion.[]
view_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
view_pattern.alphabetstringAllowed alphabets pattern[A-Za-z0-9 _.-]
profile_patternAllowDenyPattern (see below for fields)regex patterns for profiles to filter in ingestion, allowed by the table_pattern.{'allow': ['.*'], 'deny': [], 'ignoreCase': True, 'alphabet': '[A-Za-z0-9 _.-]'}
profile_pattern.allowArray of stringList of regex patterns for process groups to include in ingestion['.*']
profile_pattern.denyArray of stringList of regex patterns for process groups to exclude from ingestion.[]
profile_pattern.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
profile_pattern.alphabetstringAllowed alphabets pattern[A-Za-z0-9 _.-]
domainDict[str, AllowDenyPattern]regex patterns for tables/schemas to descide domain_key domain key (domain_key can be any string like "sales".) There can be multiple domain key specified.{}
domain.key.allowArray of stringList of regex patterns for process groups to include in ingestion['.*']
domain.key.denyArray of stringList of regex patterns for process groups to exclude from ingestion.[]
domain.key.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
domain.key.alphabetstringAllowed alphabets pattern[A-Za-z0-9 _.-]
profilingGEProfilingConfig (see below for fields){'enabled': False, 'limit': None, 'offset': None, 'reportdropped_profiles': False, 'turn_off_expensive_profiling_metrics': False, 'profile_table_level_only': False, 'include_field_null_count': True, 'include_field_min_value': True, 'include_field_max_value': True, 'include_field_mean_value': True, 'include_field_median_value': True, 'include_field_stddev_value': True, 'include_field_quantiles': False, 'include_field_distinct_value_frequencies': False, 'include_field_histogram': False, 'include_field_sample_values': True, 'allow_deny_patterns': {'allow': ['.*'], 'deny': [], 'ignoreCase': True, 'alphabet': '[A-Za-z0-9 .-]'}, 'max_number_of_fields_to_profile': None, 'profile_if_updated_since_days': 1, 'max_workers': 10, 'query_combiner_enabled': True, 'catch_exceptions': True, 'partition_profiling_enabled': True, 'bigquery_temp_table_schema': None, 'partition_datetime': None}
profiling.enabledbooleanWhether profiling should be done.False
profiling.limitintegerMax number of documents to profile. By default, profiles all documents.None
profiling.offsetintegerOffset in documents to profile. By default, uses no offset.None
profiling.report_dropped_profilesbooleanIf datasets which were not profiled are reported in source report or not. Set to True for debugging purposes.False
profiling.turn_off_expensive_profiling_metricsbooleanWhether to turn off expensive profiling or not. This turns off profiling for quantiles, distinct_value_frequencies, histogram & sample_values. This also limits maximum number of fields being profiled to 10.False
profiling.profile_table_level_onlybooleanWhether to perform profiling at table-level only, or include column-level profiling as well.False
profiling.include_field_null_countbooleanWhether to profile for the number of nulls for each column.True
profiling.include_field_min_valuebooleanWhether to profile for the min value of numeric columns.True
profiling.include_field_max_valuebooleanWhether to profile for the max value of numeric columns.True
profiling.include_field_mean_valuebooleanWhether to profile for the mean value of numeric columns.True
profiling.include_field_median_valuebooleanWhether to profile for the median value of numeric columns.True
profiling.include_field_stddev_valuebooleanWhether to profile for the standard deviation of numeric columns.True
profiling.include_field_quantilesbooleanWhether to profile for the quantiles of numeric columns.False
profiling.include_field_distinct_value_frequenciesbooleanWhether to profile for distinct value frequencies.False
profiling.include_field_histogrambooleanWhether to profile for the histogram for numeric fields.False
profiling.include_field_sample_valuesbooleanWhether to profile for the sample values for all columns.True
profiling.allow_deny_patternsAllowDenyPattern (see below for fields)regex patterns for filtering of tables or table columns to profile.{'allow': ['.*'], 'deny': [], 'ignoreCase': True, 'alphabet': '[A-Za-z0-9 _.-]'}
profiling.allow_deny_patterns.allowArray of stringList of regex patterns for process groups to include in ingestion['.*']
profiling.allow_deny_patterns.denyArray of stringList of regex patterns for process groups to exclude from ingestion.[]
profiling.allow_deny_patterns.ignoreCasebooleanWhether to ignore case sensitivity during pattern matching.True
profiling.allow_deny_patterns.alphabetstringAllowed alphabets pattern[A-Za-z0-9 _.-]
profiling.max_number_of_fields_to_profileintegerA positive integer that specifies the maximum number of columns to profile for any table. None implies all columns. The cost of profiling goes up significantly as the number of columns to profile goes up.None
profiling.profile_if_updated_since_daysnumberProfile table only if it has been updated since these many number of days. None implies profile all tables. Only Snowflake supports this.1
profiling.max_workersintegerNumber of worker threads to use for profiling. Set to 1 to disable.10
profiling.query_combiner_enabledbooleanThis feature is still experimental and can be disabled if it causes issues. Reduces the total number of queries issued and speeds up profiling by dynamically combining SQL queries where possible.True
profiling.catch_exceptionsbooleanTrue
profiling.partition_profiling_enabledbooleanTrue
profiling.bigquery_temp_table_schemastringOn bigquery for profiling partitioned tables needs to create temporary views. You have to define a dataset where these will be created. Views will be cleaned up after profiler runs. (Great expectation tech details about this (https://legacy.docs.greatexpectations.io/en/0.9.0/reference/integrations/bigquery.html#custom-queries-with-sql-datasource).None
profiling.partition_datetimestringFor partitioned datasets profile only the partition which matches the datetime or profile the latest one if not set. Only Bigquery supports this.None

Code Coordinates

  • Class Name: datahub.ingestion.source.sql.athena.AthenaSource
  • Browse on GitHub

Questions

If you've got any questions on configuring ingestion for Athena, feel free to ping us on our Slack