db-queries-bulk-migrator


Namedb-queries-bulk-migrator JSON
Version 0.3.1 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-12-02 18:33:36
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

- DT_URL (e.g. https://xxx.live.dynatrace.com)
- DT_TOKEN
  - permissions:
    - ReadConfig
    - WriteConfig
    - extensions.read
    - extensions.write
    - metrics.read

## 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](https://docs.dynatrace.com/docs/shortlink/sign-extension#cert) 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
...
```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "db-queries-bulk-migrator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/ef/e9/f51a0a275d66ea3d976798b572930e84f1734e41b71817bcd734eabb666f/db_queries_bulk_migrator-0.3.1.tar.gz",
    "platform": null,
    "description": "# Dynatrace DB Queries Extension Bulk Migrator\n\nTool to help with creating Extensions 2.0 declarative SQL extensions off of Extensions 1.0 Custom DB Queries extension configurations.\n\n## API Authentication\n\nFor 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:\n\n- DT_URL (e.g. https://xxx.live.dynatrace.com)\n- DT_TOKEN\n  - permissions:\n    - ReadConfig\n    - WriteConfig\n    - extensions.read\n    - extensions.write\n    - metrics.read\n\n## Commands\n\nUse `--help` with any command to view unique options.\n\n```\n Usage: dbqm pull [OPTIONS]\n\n Pull EF1 db queries configurations into a spreadsheet.\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 *  --dt-url             TEXT  [env var: DT_URL] [default: None] [required]                                                                                                                                                                                         \u2502\n\u2502 *  --dt-token           TEXT  [env var: DT_TOKEN] [default: None] [required]                                                                                                                                                                                       \u2502\n\u2502    --output-file        TEXT  [default: custom.remote.python.dbquery-export.xlsx]                                                                                                                                                                                  \u2502\n\u2502    --help                     Show this message and exit.  \n```\n\n### dbqm pull\n\nUsed 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.\n\n### dbqm build\n\nUsed to build extensions from a previously exported configuration excel workbook.\n\n#### Certificate and key\n\nBefore building you need to create a developer key and certificate. These will be used to sign the extension packages. Refer to the steps [here](https://docs.dynatrace.com/docs/shortlink/sign-extension#cert) for creating the certificate and key file(s). The `developer.pem` file will be used in the build command.\n\n#### Required options\n\n- `--cert-file-path` path to developer.pem\n- `--private-key-path` path to developer.pem\n- `--input-file` path to the previously exported configuration exce;\n- `--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)\n- `--credential-vault-id` a credential vault ID to be used in the created monitoring configurations\n- `--directory` path to where the migrated extensions will be stored locally\n- `--upload` upload and activate extensions after build\n- `--create-config` create an initial monitoring configuration based on the db queries configuration (in a disabled state)\n- `--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+\n- `--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)\n- `--log-directory` the directory where the log file/report will be generated\n- `--include-disabled` by default, disabled EF1 endpoints will be disabled. Use this option to include them.\n\n\nExample:\n\n```\ndbqm 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\n```\n\nAfter 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.\n\nIn 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.\n\nTo build the extension, activate it, and have a configuration created run:\n\n```\ndbqm 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\n```\n\nThis 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.\n\nEach time the build occurs it will check the environment and increment the extension version if needed.\n\nSample output:\n\n```\nProcessing input file 'C:\\workspaces\\projects\\db-queries-bulk-migrator\\db-queries-bulk-migrator\\custom.remote.python.dbquery-export.xlsx'.\n\n###### localhost_xe ######\n\nBuilt/signed extension zip: 'migrated_extensions\\custom_db.query.localhost-xe\\custom_db.query.localhost-xe-1.0.3.zip'.\nValidating...\nExtension validated: custom:db.query.localhost-xe (1.0.3)\nExtension uploaded: custom:db.query.localhost-xe (1.0.3)\nLink to monitoring configuration: https://<environment>.com/ui/hub/ext/listing/registered/custom:db.query.localhost-xe/06314501-c065-33e2-a099-577e13fd8286/edit\n\n###### localhost_DYNA ######\n\nBuilt/signed extension zip: 'migrated_extensions\\custom_db.query.localhost-dyna\\custom_db.query.localhost-dyna-1.0.3.zip'.\nValidating...\nExtension validated: custom:db.query.localhost-dyna (1.0.3)\nExtension uploaded: custom:db.query.localhost-dyna (1.0.3)\nLink to monitoring configuration: https://<environment>.com/ui/hub/ext/listing/registered/custom:db.query.localhost-dyna/620943f0-763b-3ccc-88ab-f40d586dd506/edit\n\n###### jdbc:mysql://<host>:3307/information_schema?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC ######\n\nError building extension from migrated_extensions\\custom_db.query.localhost-dyna\\src\\extension.yaml: MySQL datasource does not currently support connection strings.\n```\n\n### dbqm delete\n\n**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.**\n\n#### Required options\n\n- `--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.\n\n```\ndbqm delete --pattern custom:db.query\n```\n\nExample output/confirmation:\n```\ncustom:db.query.abc\ncustom:db.query.def\ncustom:db.query.ghi\nThe above listed 3 extensions will be deleted along with any configurations. Are you sure? [y/N]: y\n...\n```",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.3.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dd65c85e74117ed3573393056bd5574cd9bfd2d34a61b69f840176509f326af2",
                "md5": "4569778793dedd6b47e232c7d9bea9d5",
                "sha256": "00f8d22e72702fce0df9f5fac3d71b20271b91e56e70b47bf77a8ef8a8e2070e"
            },
            "downloads": -1,
            "filename": "db_queries_bulk_migrator-0.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4569778793dedd6b47e232c7d9bea9d5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 12328,
            "upload_time": "2024-12-02T18:33:35",
            "upload_time_iso_8601": "2024-12-02T18:33:35.079785Z",
            "url": "https://files.pythonhosted.org/packages/dd/65/c85e74117ed3573393056bd5574cd9bfd2d34a61b69f840176509f326af2/db_queries_bulk_migrator-0.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "efe9f51a0a275d66ea3d976798b572930e84f1734e41b71817bcd734eabb666f",
                "md5": "3cc02b03bd9befc3913187121fa0d72e",
                "sha256": "6c96911497563b8774ce7adeb050248faa8b739fc7cdc363d5921ceaa5740c92"
            },
            "downloads": -1,
            "filename": "db_queries_bulk_migrator-0.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3cc02b03bd9befc3913187121fa0d72e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 10542,
            "upload_time": "2024-12-02T18:33:36",
            "upload_time_iso_8601": "2024-12-02T18:33:36.546113Z",
            "url": "https://files.pythonhosted.org/packages/ef/e9/f51a0a275d66ea3d976798b572930e84f1734e41b71817bcd734eabb666f/db_queries_bulk_migrator-0.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-02 18:33:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "db-queries-bulk-migrator"
}
        
Elapsed time: 0.99630s