### Install and Initialize Apache Superset Source: https://github.com/amundsen-io/amundsen/blob/main/docs/tutorials/data-preview-with-superset.md Commands to install Apache Superset, initialize the database, create an admin user, and start the development server. ```bash pip install apache-superset superset db upgrade export FLASK_APP=superset superset fab create-admin superset load_examples superset init superset run -p 8088 --with-threads --reload --debugger ``` -------------------------------- ### Start Metadata Service from Source (Bash) Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/README.md Clones the Amundsen repository, sets up a virtual environment, installs the library from source with all extras, and runs the metadata service. Includes a curl command to check the service's health. ```bash $ git clone https://github.com/amundsen-io/amundsenmetadatalibrary.git $ cd amundsenmetadatalibrary $ python3 -m venv venv $ source venv/bin/activate $ pip3 install -e ".[all]" . $ python3 metadata_service/metadata_wsgi.py -- In a different terminal, verify getting HTTP/1.0 200 OK $ curl -v http://localhost:5002/healthcheck ``` -------------------------------- ### Install and Run Amundsen Standalone Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/installation.md This sequence of commands clones the repository, builds the frontend static assets using npm, installs Python dependencies within a virtual environment, and starts the application server. It serves as the primary setup process for local development environments. ```bash git clone https://github.com/amundsen-io/amundsen.git cd amundsen/frontend/amundsen_application/static npm install npm run build cd ../../ python3 -m venv venv source venv/bin/activate pip3 install -e ".[all]" . python3 amundsen_application/wsgi.py ``` -------------------------------- ### Start Metadata Service from Distribution (Bash) Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/README.md Installs and runs the Amundsen Metadata service using pip. It sets up a virtual environment, installs the package, and starts the service. A curl command is provided to verify the health check endpoint. ```bash $ venv_path=[path_for_virtual_environment] $ python3 -m venv $venv_path $ source $venv_path/bin/activate $ pip3 install amundsen-metadata $ python3 metadata_service/metadata_wsgi.py -- In a different terminal, verify getting HTTP/1.0 200 OK $ curl -v http://localhost:5002/healthcheck ``` -------------------------------- ### Install SQLAlchemy for Exemplary Client Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/examples/announcement_client.md This bash command shows how to install the SQLAlchemy library, which is a dependency for running the exemplary announcement client. It specifies a particular version (1.3.17) for compatibility. ```bash pip install SQLAlchemy==1.3.17 ``` -------------------------------- ### Install and Run Amundsen Search Service from Source Source: https://github.com/amundsen-io/amundsen/blob/main/search/README.md Steps to clone the Amundsen repository, set up a virtual environment, install dependencies, and run the search service. It also includes a command to check the service's health. ```bash $ git clone https://github.com/amundsen-io/amundsen.git $ cd search $ venv_path=[path_for_virtual_environment] $ python3 -m venv $venv_path $ source $venv_path/bin/activate $ pip3 install -e ".[all]" . $ python3 search_service/search_wsgi.py # In a different terminal, verify the service is up by running $ curl -v http://localhost:5001/healthcheck ``` -------------------------------- ### Install and Run Amundsen Search Service from Distribution Source: https://github.com/amundsen-io/amundsen/blob/main/search/README.md Instructions to set up a virtual environment, install the Amundsen Search service, and run it. It also includes a command to verify the service is running using curl. ```bash $ venv_path=[path_for_virtual_environment] $ python3 -m venv $venv_path $ source $venv_path/bin/activate $ python3 setup.py install $ python3 search_service/search_wsgi.py # In a different terminal, verify the service is up by running $ curl -v http://localhost:5001/healthcheck ``` -------------------------------- ### Install Amundsen Databuilder Source: https://github.com/amundsen-io/amundsen/blob/main/docs/developer_guide.md Installs the Amundsen Databuilder library locally. This involves cloning the repository, setting up a virtual environment, and installing the package and its dependencies. ```bash cd ~/src/ git clone git@github.com:amundsen-io/amundsendatabuilder.git cd ~/src/amundsendatabuilder virtualenv venv source venv/bin/activate python setup.py install pip install -r requirements.txt ``` -------------------------------- ### Configure and Launch AWS Glue Metadata Extractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Shows the configuration setup for the GlueExtractor, including optional partition badge labels and filter definitions for database and table scoping. ```python job_config = ConfigFactory.from_dict({ 'extractor.glue.{}'.format(GlueExtractor.CLUSTER_KEY): cluster_identifier_string, 'extractor.glue.{}'.format(GlueExtractor.FILTER_KEY): [], 'extractor.glue.{}'.format(GlueExtractor.PARTITION_BADGE_LABEL_KEY): label_string, }) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=GlueExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Configure and Launch HiveTableMetadataExtractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Provides an example of configuring the HiveTableMetadataExtractor to extract table and column metadata from a Hive metastore using a SQLAlchemy connection string. ```python job_config = ConfigFactory.from_dict({ 'extractor.hive_table_metadata.{}'.format(HiveTableMetadataExtractor.WHERE_CLAUSE_SUFFIX_KEY): where_clause_suffix, 'extractor.hive_table_metadata.extractor.sqlalchemy.{}'.format(SQLAlchemyExtractor.CONN_STRING): connection_string()}) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=HiveTableMetadataExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Production Deployment with Gunicorn (Bash) Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/README.md Installs Gunicorn and runs the Amundsen Metadata service using it. This is recommended for production environments over the default Werkzeug development server. Links to Gunicorn documentation are provided. ```bash $ pip install gunicorn $ gunicorn metadata_service.metadata_wsgi ``` -------------------------------- ### Configuration Environment Variable Example (Bash) Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/README.md Demonstrates how to set the METADATA_SVC_CONFIG_MODULE_CLASS environment variable to specify a custom configuration class for the Amundsen Metadata service, such as a production configuration. ```bash METADATA_SVC_CONFIG_MODULE_CLASS=metadata_service.config.ProdConfig ``` -------------------------------- ### Deploy Amundsen using Helm Source: https://github.com/amundsen-io/amundsen/blob/main/amundsen-kube-helm/README.md Commands to install the Amundsen Helm chart using both Helm 2 and Helm 3 syntax. ```bash # Helm 2 helm install ./templates/helm --values impl/helm/dev/values.yaml # Helm 3 helm install my-amundsen ./templates/helm --values impl/helm/dev/values.yaml ``` -------------------------------- ### Run Amundsen Search Service in Production with Gunicorn Source: https://github.com/amundsen-io/amundsen/blob/main/search/README.md Instructions for installing Gunicorn and running the Amundsen Search service using it for a production environment. It also includes a command to check the service's health. ```bash $ pip3 install gunicorn $ gunicorn search_service.search_wsgi # In a different terminal, verify the service is up by running $ curl -v http://localhost:8000/healthcheck ``` -------------------------------- ### Configure Pattern Matching Notices with Wildcards (JavaScript) Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/application_config.md This JavaScript configuration demonstrates using wildcards within resource names to target resources that start with a specific pattern, like 'foo_*'. This allows for more granular control over which resources receive notices, such as tables or dashboards with names following a convention. ```javascript resourceConfig: { [ResourceType.table]: { ... //Table Resource Configuration notices: { "...foo_*": { severity: NoticeSeverity.INFO, messageHtml: `This table has information`, }, }, }, [ResourceType.dashboard]: { ... //Dashboard Resource Configuration notices: { "...foo_*": { severity: NoticeSeverity.INFO, messageHtml: `This dashboard has information`, }, }, }, }, ``` -------------------------------- ### Configure Ingress for Amundsen Source: https://github.com/amundsen-io/amundsen/blob/main/amundsen-kube-helm/README.md Example YAML configuration to enable and configure Ingress for an on-premise Kubernetes deployment of Amundsen. ```yaml ingress: enabled: true annotations: {} hosts: - host: amundsen-test.your-domain.com paths: [/] tls: - hosts: - amundsen-test.your-domain.com ``` -------------------------------- ### Start Metadata Service with Docker (Bash) Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/README.md Pulls the latest Amundsen metadata service Docker image and runs it, exposing port 5002. An alternative command shows how to run it with Gunicorn for a production environment. A curl command is included to verify the health check. ```bash $ docker pull amundsendev/amundsen-metadata:latest $ docker run -p 5002:5002 amundsendev/amundsen-metadata # - alternative, for production environment with Gunicorn (see its homepage link below) $ ## docker run -p 5002:5002 amundsendev/amundsen-metadata gunicorn --bind 0.0.0.0:5002 metadata_service.metadata_wsgi -- In a different terminal, verify getting HTTP/1.0 200 OK $ curl -v http://localhost:5002/healthcheck ``` -------------------------------- ### Configure and Launch Apache Superset Table Relationship Job Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Shows the configuration for the ApacheSupersetTableExtractor, which maps relationships between dashboards and tables. This setup requires additional mapping configurations for drivers and databases to ensure proper data model alignment. ```python tmp_folder = f'/tmp/amundsen/dashboard' dict_config = { f'loader.filesystem_csv_neo4j.{FsNeo4jCSVLoader.NODE_DIR_PATH}': f'{tmp_folder}/nodes', f'loader.filesystem_csv_neo4j.{FsNeo4jCSVLoader.RELATION_DIR_PATH}': f'{tmp_folder}/relationships', f'loader.filesystem_csv_neo4j.{FsNeo4jCSVLoader.SHOULD_DELETE_CREATED_DIR}': True, f'extractor.apache_superset.{ApacheSupersetBaseExtractor.DASHBOARD_GROUP_ID}': '1', f'extractor.apache_superset.{ApacheSupersetBaseExtractor.DASHBOARD_GROUP_NAME}': 'dashboard group', f'extractor.apache_superset.{ApacheSupersetBaseExtractor.DASHBOARD_GROUP_DESCRIPTION}': 'dashboard group description', f'extractor.apache_superset.{ApacheSupersetBaseExtractor.CLUSTER}': 'gold', f'extractor.apache_superset.{ApacheSupersetBaseExtractor.APACHE_SUPERSET_SECURITY_SETTINGS_DICT}': dict( username='admin', password='admin', provider='db') } job_config = ConfigFactory.from_dict(dict_config) task = DefaultTask(extractor=ApacheSupersetTableExtractor(), loader=FsNeo4jCSVLoader()) job = DefaultJob(conf=job_config, task=task) job.launch() ``` -------------------------------- ### Fix Neo4j UI Startup Error on Windows (VS Code) Source: https://github.com/amundsen-io/amundsen/blob/main/docs/windows_troubleshooting.md Addresses Neo4j UI startup failures on Windows by instructing users to change the 'End of Line Sequence' setting in VS Code for the neo4j.conf file. This resolves issues caused by incorrect line endings that prevent Neo4j from starting. ```text neo4j_amundsen | Unrecognized VM option 'UseG1GC neo4j_amundsen | Did you mean '(+/-)UseG1GC'? neo4j_amundsen | Error: Could not create the Java Virtual Machine. neo4j_amundsen | Error: A fatal exception has occurred. Program will exit. ``` -------------------------------- ### Registering a Custom Preview Client in setup.py Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/examples/redash_preview_client.md This snippet demonstrates how to add a custom preview client class to the entry_points configuration in setup.py. It maps the table_preview_client_class key to your specific implementation class. ```python entry_points=""" ... [preview_client] table_preview_client_class = amundsen_application.base.examples.example_redash_preview_client:RedashSimplePreviewClient """ ``` ```bash python3 setup.py install ``` -------------------------------- ### Python RedashPreviewClient - Get Query ID Example Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/examples/redash_preview_client.md This Python code snippet demonstrates how to implement the `get_redash_query_id` method within a custom `RedashPreviewClient`. It maps database and cluster combinations to specific Redash query IDs, allowing Amundsen to fetch the correct pre-defined query for data previews. ```python from typing import Dict, Optional class RedashPreviewClient: ... def get_redash_query_id(self, params: Dict) -> Optional[int]: SOURCE_DB_QUERY_MAP = { 'snowflake.open_data': 1, 'snowflake.marketing': 27, } database = params['database'] cluster = params['cluster'] db_cluster_key = f'{database}.{cluster}' return SOURCE_DB_QUERY_MAP.get(db_cluster_key) ``` -------------------------------- ### Register Custom Preview Client in setup.py Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/examples/superset_preview_client.md Configures the Amundsen application to use a custom preview client class by defining an entry point in the setup.py file. ```ini entry_points=""" ... [preview_client] table_preview_client_class = amundsen_application.base.examples.example_superset_preview_client:SupersetPreviewClient """ ``` -------------------------------- ### Configure Python Entry Points for Amundsen Plugins Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/configuration.md Defines custom entry points in setup.py to register plugins for action logging, table preview clients, and announcement clients. This allows the application to dynamically load custom implementations for these core features. ```python entry_points=""" [action_log.post_exec.plugin] analytic_clients_action_log = path.to.file:custom_action_log_method [preview_client] table_preview_client_class = amundsen_application.base.examples.example_superset_preview_client:SupersetPreviewClient [announcement_client] announcement_client_class = amundsen_application.base.examples.example_announcement_client:SQLAlchemyAnnouncementClient """ ``` -------------------------------- ### Configure and Launch Cassandra Metadata Extractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Demonstrates how to configure the CassandraExtractor with cluster details, filter functions, and custom kwargs. The job is then executed using a DefaultJob instance. ```python job_config = ConfigFactory.from_dict({ 'extractor.cassandra.{}'.format(CassandraExtractor.CLUSTER_KEY): cluster_identifier_string, 'extractor.cassandra.{}'.format(CassandraExtractor.IPS_KEY): [127.0.0.1], 'extractor.cassandra.{}'.format(CassandraExtractor.KWARGS_KEY): {}, 'extractor.cassandra.{}'.format(CassandraExtractor.FILTER_FUNCTION_KEY): my_filter_function, }) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=CassandraExtractor(), loader=AnyLoader())) job.launch() ``` ```python def filter(keytab, table): # return False if you don't want to add that table and True if you want to add return True ``` ```python config = ConfigFactory.from_dict({ 'extractor.cassandra.{}'.format(CassandraExtractor.IPS_KEY): [127.0.0.1], 'extractor.cassandra.{}'.format(CassandraExtractor.KWARGS_KEY): {'port': 9042} }) # it will call the cluster constructor like this Cluster([127.0.0.1], **kwargs) ``` -------------------------------- ### Metadata Service API - Get Table Lineage Source: https://context7.com/amundsen-io/amundsen/llms.txt Retrieves upstream and downstream lineage information for a table to understand data flow. ```APIDOC ## GET /table/{cluster}/{database}/{schema}/{name}/lineage ### Description Retrieves upstream and downstream lineage information for a table. ### Method GET ### Endpoint /table/{cluster}/{database}/{schema}/{name}/lineage ### Parameters #### Path Parameters - **cluster** (string) - Required - The cluster name of the table. - **database** (string) - Required - The database name of the table. - **schema** (string) - Required - The schema name of the table. - **name** (string) - Required - The table name. #### Query Parameters - **direction** (string) - Optional - 'upstream', 'downstream', or 'both'. Defaults to 'both'. - **depth** (integer) - Optional - The depth of lineage to retrieve. Defaults to 1. ### Response #### Success Response (200) - **key** (string) - The table identifier. - **upstream_entities** (array) - List of upstream entities. - **downstream_entities** (array) - List of downstream entities. #### Response Example ```json { "key": "gold://hive.test_schema/test_table", "upstream_entities": [ {"key": "gold://hive.raw_schema/source_table", "level": 1} ], "downstream_entities": [ {"key": "gold://hive.analytics/derived_table", "level": 1} ] } ``` ``` -------------------------------- ### Kubernetes Helm Overrides for Okta Integration Source: https://github.com/amundsen-io/amundsen/blob/main/docs/authentication/oidc.md These are the necessary property overrides for a Helm installation to enable OIDC authentication with Okta. Ensure you have a custom OIDC frontend image. ```yaml oidcEnabled: true createOidcSecret: true OIDC_CLIENT_ID: YOUR_CLIENT_ID OIDC_CLIENT_SECRET: YOUR_SECRET_ID OIDC_ORG_URL: https://amundsen.okta.com OIDC_AUTH_SERVER_ID: default frontEndServiceImage: 123.dkr.ecr.us-west-2.amazonaws.com/edmunds/amundsen-frontend:oidc-test ``` -------------------------------- ### Configure and Launch SQLAlchemyExtractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Demonstrates how to configure the SQLAlchemyExtractor using a connection string and SQL query. It utilizes the DefaultJob and DefaultTask classes to execute the extraction process. ```python job_config = ConfigFactory.from_dict({ 'extractor.sqlalchemy.{}'.format(SQLAlchemyExtractor.CONN_STRING): connection_string(), 'extractor.sqlalchemy.{}'.format(SQLAlchemyExtractor.EXTRACT_SQL): sql, 'extractor.sqlalchemy.model_class': 'package.module.class_name'}) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=SQLAlchemyExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Configure and Launch DBAPIExtractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Demonstrates how to configure the DBAPIExtractor using a connection object, a SQL statement, and a model class. The extractor is then executed within a DefaultJob task. ```python job_config = ConfigFactory.from_dict({ 'extractor.dbapi{}'.format(DBAPIExtractor.CONNECTION_CONFIG_KEY): db_api_conn, 'extractor.dbapi.{}'.format(DBAPIExtractor.SQL_CONFIG_KEY ): select_sql_stmt, 'extractor.dbapi.model_class': 'package.module_name.class_name' }) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=DBAPIExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Configure Google Analytics Plugin Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/application_config.md Enables Google Analytics tracking by specifying the tracking ID and sample rate within the analytics plugins configuration. Requires the '@analytics/google-analytics' plugin to be installed. ```javascript analytics: { plugins: [ googleAnalytics({ trackingId: '', sampleRate: 100 }), ], } ``` -------------------------------- ### Dockerfile for Amundsen Frontend OIDC Build Source: https://github.com/amundsen-io/amundsen/blob/main/docs/authentication/oidc.md This Dockerfile snippet adds OIDC support to the Amundsen frontend. It installs the necessary OIDC dependencies and sets environment variables for Flask-OIDC configuration. ```dockerfile RUN pip3 install .[oidc] ENV FRONTEND_SVC_CONFIG_MODULE_CLASS=amundsen_application.oidc_config.OidcConfig ENV FLASK_APP_MODULE_NAME=flaskoidc ENV FLASK_APP_CLASS_NAME=FlaskOIDC ENV FLASK_OIDC_WHITELISTED_ENDPOINTS=status,healthcheck,health ENV SQLALCHEMY_DATABASE_URI=sqlite:///sessions.db ``` -------------------------------- ### Configure and Launch HiveTableLastUpdatedExtractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Shows the configuration for HiveTableLastUpdatedExtractor, including performance tuning options like filesystem worker pool size and SQL where clauses for partitioned and non-partitioned tables. ```python job_config = ConfigFactory.from_dict({ 'extractor.hive_table_last_updated.partitioned_table_where_clause_suffix': partitioned_table_where_clause, 'extractor.hive_table_last_updated.non_partitioned_table_where_clause_suffix'): non_partitioned_table_where_clause, 'extractor.hive_table_last_updated.extractor.sqlalchemy.{}'.format( SQLAlchemyExtractor.CONN_STRING): connection_string, 'extractor.hive_table_last_updated.extractor.fs_worker_pool_size': pool_size, 'extractor.hive_table_last_updated.filesystem.{}'.format(FileSystem.DASK_FILE_SYSTEM): s3fs.S3FileSystem( anon=False, config_kwargs={'max_pool_connections': pool_size})}) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=HiveTableLastUpdatedExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Mask Google Tag Manager URL with npm Source: https://github.com/amundsen-io/amundsen/blob/main/docs/faq.md This command masks the Google Tag Manager URL to bypass adblockers. It requires Node.js and npm to be installed. The output is a masked URL that should be used in the frontend configuration. ```bash npm run mask www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX ``` -------------------------------- ### Configure and Launch DbtExtractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md Shows the configuration for the DbtExtractor, which processes dbt manifest and catalog files. It supports optional features like lineage extraction, tag importing as badges, and source URL linking. ```python job_config = ConfigFactory.from_dict({ f'extractor.dbt.{DbtExtractor.DATABASE_NAME}': 'snowflake', f'extractor.dbt.{DbtExtractor.MANIFEST_JSON}': catalog_file_loc, f'extractor.dbt.{DbtExtractor.DATABASE_NAME}': json.dumps(manifest_data), f'extractor.dbt.{DbtExtractor.SOURCE_URL}': 'https://github.com/your-company/your-repo/tree/main', f'extractor.dbt.{DbtExtractor.EXTRACT_TABLES}': True, f'extractor.dbt.{DbtExtractor.EXTRACT_DESCRIPTIONS}': True, f'extractor.dbt.{DbtExtractor.EXTRACT_TAGS}': True, f'extractor.dbt.{DbtExtractor.IMPORT_TAGS_AS}': 'badges', f'extractor.dbt.{DbtExtractor.EXTRACT_LINEAGE}': True, }) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=DbtExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Register Custom Announcement Client Source: https://github.com/amundsen-io/amundsen/blob/main/frontend/docs/examples/announcement_client.md This Python code snippet illustrates how to register a custom announcement client implementation within Amundsen's `setup.py` file. It uses the `entry_points` mechanism to specify the custom client class under the `[announcement_client]` group. ```python entry_points=""" ... [announcement_client] announcement_client_class = amundsen_application.base.examples.example_announcement_client:SQLAlchemyAnnouncementClient """ ``` -------------------------------- ### Extract Dremio Metadata Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md This Python code snippet demonstrates how to configure and launch the DremioMetadataExtractor to extract table and column metadata from Dremio. It requires the Dremio ODBC driver to be installed and specifies connection details like user, password, and host. ```python job_config = ConfigFactory.from_dict({ 'extractor.dremio.{}'.format(DremioMetadataExtractor.DREMIO_USER_KEY): DREMIO_USER, 'extractor.dremio.{}'.format(DremioMetadataExtractor.DREMIO_PASSWORD_KEY): DREMIO_PASSWORD, 'extractor.dremio.{}'.format(DremioMetadataExtractor.DREMIO_HOST_KEY): DREMIO_HOST}) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=DremioMetadataExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Configure MySQL Proxy Settings Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/docs/proxy/mysql.md This snippet shows how to configure the MySQL proxy by setting the PROXY_CLI and SQLALCHEMY_DATABASE_URI. It assumes the use of environment variables for the database connection string. ```python PROXY_CLI = PROXY_CLIS['MYSQL'] SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI', {mysql_connection_string}) # other fileds used for mysql proxy ...... ``` -------------------------------- ### Run Amundsen Metadata Service with Apache Atlas via Docker Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/README.md This bash command shows how to start the Amundsen metadata service using Docker with Apache Atlas as the backend. It configures essential environment variables for connecting to the Atlas server. ```bash $ docker run -p 5002:5002 --env PROXY_CLIENT=ATLAS --env PROXY_PORT=21000 --env PROXY_HOST=atlasserver --env CREDENTIALS_PROXY_USER=atlasuser --env CREDENTIALS_PROXY_PASSWORD=password amundsen-metadata:latest ``` -------------------------------- ### Resolve databuilder 'extras_require' Error on Windows Source: https://github.com/amundsen-io/amundsen/blob/main/docs/windows_troubleshooting.md Fixes the 'extras_require' error during Amundsen databuilder installation on Windows. This error occurs due to symlink interpretation issues with Windows. The solution involves copying the root requirements_dev.txt file over the one in databuilder/ to bypass the symlink. ```bash error in amundsen-databuilder setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers. ``` -------------------------------- ### Configure and Launch RedashDashboardExtractor Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md This snippet demonstrates how to configure and launch the RedashDashboardExtractor using the DefaultTask and DefaultJob. It shows how to set Redash API credentials, base URLs, and an optional table parser function. The extractor depends on Redash API endpoints and is tested against Redash versions 8 and 9. ```python extractor = RedashDashboardExtractor() task = DefaultTask(extractor=extractor, loader=FsNeo4jCSVLoader()) job_config = ConfigFactory.from_dict({ 'extractor.redash_dashboard.redash_base_url': redash_base_url, # ex: https://redash.example.org 'extractor.redash_dashboard.api_base_url': api_base_url, # ex: https://redash.example.org/api 'extractor.redash_dashboard.api_key': api_key, # ex: abc1234 'extractor.redash_dashboard.table_parser': table_parser, # ex: my_library.module.parse_tables 'extractor.redash_dashboard.redash_version': redash_version # ex: 8. optional, default=9 }) job = DefaultJob(conf=job_config, task=task, publisher=Neo4jCsvPublisher()) job.launch() ``` -------------------------------- ### Extract Databricks SQL Dashboards with Python Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md This Python code configures and launches the DatabricksSQLDashboardExtractor to pull metadata from Databricks SQL dashboards. It requires Databricks host and API token for authentication. The example shows how to set these configurations and integrate with the Amundsen job execution pipeline. ```python extractor = DatabricksSQLDashboardExtractor() task = DefaultTask(extractor=extractor, loader=FsNeo4jCSVLoader()) job_config = ConfigFactory.from_dict({ f"extractor.databricks_sql_extractor.{DatabricksSQLDashboardExtractor.DATABRICKS_HOST_KEY}": "MY-DATABRICKS-API-TOKEN", f"extractor.databricks_sql_extractor.{DatabricksSQLDashboardExtractor.DATABRICKS_API_TOKEN_KEY}": "https://my-company.cloud.databricks.com", # ...plus nessescary configs for neo4j... }) job = DefaultJob( conf=job_config, task=task, publisher=Neo4jCsvPublisher(), ) job.launch() ``` -------------------------------- ### Extract Tableau Dashboard Last Modified Timestamp Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md This Python code snippet shows how to use the TableauDashboardLastModifiedExtractor to get the last updated timestamp for Tableau workbooks. It configures the extractor with Tableau connection details and specifies a timestamp format for transformation, then initiates the data extraction job. ```python extractor = TableauDashboardQueryExtractor() # Note: This seems to be a typo in the original text, likely should be TableauDashboardLastModifiedExtractor task = DefaultTask(extractor=extractor, loader=FsNeo4jCSVLoader()) job_config = ConfigFactory.from_dict({ 'extractor.tableau_dashboard_last_modified.tableau_host': tableau_host, 'extractor.tableau_dashboard_last_modified.api_version': tableau_api_version, 'extractor.tableau_dashboard_last_modified.site_name': tableau_site_name, 'extractor.tableau_dashboard_last_modified.tableau_personal_access_token_name': tableau_personal_access_token_name, 'extractor.tableau_dashboard_last_modified.tableau_personal_access_token_secret': tableau_personal_access_token_secret, 'extractor.tableau_dashboard_last_modified.excluded_projects': tableau_excluded_projects, 'extractor.tableau_dashboard_last_modified.cluster': tableau_dashboard_cluster, 'extractor.tableau_dashboard_last_modified.database': tableau_dashboard_database, 'extractor.tableau_dashboard_last_modified.transformer.timestamp_str_to_epoch.timestamp_format': "%Y-%m-%dT%H:%M:%SZ", }) job = DefaultJob(conf=job_config, task=task, publisher=Neo4jCsvPublisher()) job.launch() ``` -------------------------------- ### Implement Custom User Detail Method Source: https://github.com/amundsen-io/amundsen/blob/main/metadata/docs/configurations.md Provides a custom function to fetch user details from external systems. The function must return a dictionary matching the UserSchema structure. ```python def get_user_details(user_id): user_info = { 'email': 'test@email.com', 'user_id': user_id, 'first_name': 'Firstname', 'last_name': 'Lastname', 'full_name': 'Firstname Lastname', } return user_info USER_DETAIL_METHOD = get_user_details ``` -------------------------------- ### Extract Snowflake Table Last Updated Timestamp Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md This Python code configures and launches an extractor to get the last updated timestamp for tables in a Snowflake database. It requires connection details and optionally accepts a WHERE clause suffix for filtering. The output is used to update table metadata. ```python job_config = ConfigFactory.from_dict({ 'extractor.snowflake_table_last_updated.{}'.format(SnowflakeTableLastUpdatedExtractor.SNOWFLAKE_DATABASE_KEY): 'YourDbName', 'extractor.snowflake_table_last_updated.{}'.format(SnowflakeTableLastUpdatedExtractor.WHERE_CLAUSE_SUFFIX_KEY): where_clause_suffix, 'extractor.snowflake_table_last_updated.{}'.format(SnowflakeTableLastUpdatedExtractor.USE_CATALOG_AS_CLUSTER_NAME): True, 'extractor.snowflake_table_last_updated.extractor.sqlalchemy.{}'.format(SQLAlchemyExtractor.CONN_STRING): connection_string()}) job = DefaultJob( conf=job_config, task=DefaultTask( extractor=SnowflakeTableLastUpdatedExtractor(), loader=AnyLoader())) job.launch() ``` -------------------------------- ### Extract OpenLineage Table Lineage Source: https://github.com/amundsen-io/amundsen/blob/main/databuilder/README.md This extractor processes OpenLineage events in ndjson format to extract table lineage information. It allows customization of JSON keys for inputs, outputs, and dataset attributes like namespace, database, and name. The example demonstrates configuring this extractor with an Atlas CSV publisher. ```python from amundsen_common.utils.config_factory import ConfigFactory from databuilder.extractor.base_extractor import Extractor from databuilder.loader.atlas_csv_loader import FsAtlasCSVLoader from databuilder.publisher.atlas_csv_publisher import AtlasCSVPublisher from databuilder.task.task_suite import DefaultTask from databuilder.job.job_suite import DefaultJob from databuilder.extractor.openlineage_extractor import OpenLineageTableLineageExtractor tmp_folder = f'/tmp/amundsen/lineage' dict_config = { f'loader.filesystem_csv_atlas.{FsAtlasCSVLoader.ENTITY_DIR_PATH}': f'{tmp_folder}/entities', f'loader.filesystem_csv_atlas.{FsAtlasCSVLoader.RELATIONSHIP_DIR_PATH}': f'{tmp_folder}/relationships', f'loader.filesystem_csv_atlas.{FsAtlasCSVLoader.SHOULD_DELETE_CREATED_DIR}': False, f'publisher.atlas_csv_publisher.{AtlasCSVPublisher.ATLAS_CLIENT}': 'http://localhost:21000', # Placeholder for AtlasClient initialization f'publisher.atlas_csv_publisher.{AtlasCSVPublisher.ENTITY_DIR_PATH}': f'{tmp_folder}/entities', f'publisher.atlas_csv_publisher.{AtlasCSVPublisher.RELATIONSHIP_DIR_PATH}': f'{tmp_folder}/relationships', f'publisher.atlas_csv_publisher.{AtlasCSVPublisher.ATLAS_ENTITY_CREATE_BATCH_SIZE}': 10, f'extractor.openlineage_tablelineage.{OpenLineageTableLineageExtractor.CLUSTER_NAME}': 'datalab', f'extractor.openlineage_tablelineage.{OpenLineageTableLineageExtractor.OL_DATASET_NAMESPACE_OVERRIDE}': 'hive_table', f'extractor.openlineage_tablelineage.{OpenLineageTableLineageExtractor.TABLE_LINEAGE_FILE_LOCATION}': 'input_dir/openlineage_nd.json', } job_config = ConfigFactory.from_dict(dict_config) task = DefaultTask(extractor=OpenLineageTableLineageExtractor(), loader=FsAtlasCSVLoader()) job = DefaultJob(conf=job_config, task=task, publisher=AtlasCSVPublisher()) job.launch() ```