Skip to main content

Dynatrace DB Queries Extension Bulk Migrator

Tool to help with creating Extensions 2.0 declarative SQL extensions off of Extensions 1.0 Custom DB Queries extension configurations.

API Authentication

For commands that interact with the Dynatrace API you need to provide an API URL and Access token. These can be provided on the command line but it is recommended to use environment variables:

Commands

Use --help with any command to view unique options.

 Usage: dbqm pull [OPTIONS]

 Pull EF1 db queries configurations into a spreadsheet.

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ *  --dt-url             TEXT  [env var: DT_URL] [default: None] [required]                                                                                                                                                                                         │
│ *  --dt-token           TEXT  [env var: DT_TOKEN] [default: None] [required]                                                                                                                                                                                       │
│    --output-file        TEXT  [default: custom.remote.python.dbquery-export.xlsx]                                                                                                                                                                                  │
│    --help                     Show this message and exit.  

dbqm pull

Used to pull all EF1 Custom DB Queries configurations and export them to an Excel sheet for manual review and as an input to later steps.

dbqm build

Used to build extensions from a previously exported configuration excel workbook.

Certificate and key

Before building you need to create a developer key and certificate. These will be used to sign the extension packages. Refer to the steps here for creating the certificate and key file(s). The developer.pem file will be used in the build command.

Required options

  • --cert-file-path path to developer.pem
  • --private-key-path path to developer.pem
  • --input-file path to the previously exported configuration exce;
  • --merge-endpoints tells the tool to merge endpoints based on a matching host or jdbc string (to avoid hitting limits if it were one extension per EF1 DB queries endpoint)
  • --credential-vault-id a credential vault ID to be used in the created monitoring configurations
  • --directory path to where the migrated extensions will be stored locally
  • --upload upload and activate extensions after build
  • --create-config create an initial monitoring configuration based on the db queries configuration (in a disabled state)
  • --pre-cron set this if you are waiting to update AG to 1.301, by default it will set the cron schedule in the new extension but this is only available in AG 1.301+
  • --scope sets the AG group any created configs will be assigned. If not prefixed with 'ag_group-' this will be added automatically (default: 'ag_group-default)
  • --log-directory the directory where the log file/report will be generated
  • --include-disabled by default, disabled EF1 endpoints will be disabled. Use this option to include them.

Example:

dbqm build --cert-file-path=developer.pem --private-key-path=developer.pem  --input-file=custom.remote.python.dbquery-export.xlsx --merge-endpoints --directory=C:\workspaces\migrated_extensions

After running in the directory (default: migrated_extensions) you will see a directory per new extension which will contain a src directory and a signed zip of the new extension.

In addtion to just building the extensions you can both have them uploaded to the environment, activated, and have an initial monitoring configuration created with what was avaialble in the original DB queries configurations.

To build the extension, activate it, and have a configuration created run:

dbqm build --cert-file-path=developer.pem --private-key-path=developer.pem  --input-file=custom.remote.python.dbquery-export.xlsx --merge-endpoints --directory=C:\workspaces\migrated_extensions --upload --create-config --scope=myActiveGateGroup

This will generate a report like \.db-queries-build-2024-11-08_18-16.txt with a summary of how the build/activation process went. After building, you should review this file for any potential issues that may need to be addressed.

Each time the build occurs it will check the environment and increment the extension version if needed.

Sample output:

Processing input file 'C:\workspaces\projects\db-queries-bulk-migrator\db-queries-bulk-migrator\custom.remote.python.dbquery-export.xlsx'.

###### localhost_xe ######

Built/signed extension zip: 'migrated_extensions\custom_db.query.localhost-xe\custom_db.query.localhost-xe-1.0.3.zip'.
Validating...
Extension validated: custom:db.query.localhost-xe (1.0.3)
Extension uploaded: custom:db.query.localhost-xe (1.0.3)
Link to monitoring configuration: https://<environment>.com/ui/hub/ext/listing/registered/custom:db.query.localhost-xe/06314501-c065-33e2-a099-577e13fd8286/edit

###### localhost_DYNA ######

Built/signed extension zip: 'migrated_extensions\custom_db.query.localhost-dyna\custom_db.query.localhost-dyna-1.0.3.zip'.
Validating...
Extension validated: custom:db.query.localhost-dyna (1.0.3)
Extension uploaded: custom:db.query.localhost-dyna (1.0.3)
Link to monitoring configuration: https://<environment>.com/ui/hub/ext/listing/registered/custom:db.query.localhost-dyna/620943f0-763b-3ccc-88ab-f40d586dd506/edit

###### jdbc:mysql://<host>:3307/information_schema?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC ######

Error building extension from migrated_extensions\custom_db.query.localhost-dyna\src\extension.yaml: MySQL datasource does not currently support connection strings.

dbqm delete

This command is primarily for use during the migration process for when mistakes are made or changes are required. It allows you to completely delete the created extensions. There are a number of prompts/checks to help you avoid mistakes but use caution with this command as it can be used to delete all traces of any 2.0 extension.

Required options

  • --pattern a pattern using 'contains' logic that will match 2.0 extension names for deletion. It will not allow an empty value and if a pattern that doesn't use db.query is used it will warn/prompt you if you want to continue.
dbqm delete --pattern custom:db.query

Example output/confirmation:

custom:db.query.abc
custom:db.query.def
custom:db.query.ghi
The above listed 3 extensions will be deleted along with any configurations. Are you sure? [y/N]: y
...

Release files for db-queries-bulk-migrator 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for db-queries-bulk-migrator 0.3.1
File Size Uploaded
db_queries_bulk_migrator-0.3.1.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for db-queries-bulk-migrator 0.3.1
File Interpreter ABI Platform
db_queries_bulk_migrator-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / db_queries_bulk_migrator-0.3.1.tar.gz

Download URL db_queries_bulk_migrator-0.3.1.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6c96911497563b8774ce7adeb050248faa8b739fc7cdc363d5921ceaa5740c92
BLAKE2b-256 checksum
How to use checksums
efe9f51a0a275d66ea3d976798b572930e84f1734e41b71817bcd734eabb666f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Windows/10

Release files / db_queries_bulk_migrator-0.3.1-py3-none-any.whl

Download URL db_queries_bulk_migrator-0.3.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00f8d22e72702fce0df9f5fac3d71b20271b91e56e70b47bf77a8ef8a8e2070e
BLAKE2b-256 checksum
How to use checksums
dd65c85e74117ed3573393056bd5574cd9bfd2d34a61b69f840176509f326af2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.10.12 Windows/10

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page