dqlmagic 1.3.2__tar.gz → 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/PKG-INFO +19 -22
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic/__init__.py +5 -5
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic/dqlmagic.py +15 -7
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic.egg-info/PKG-INFO +19 -22
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/readme.md +18 -21
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic.egg-info/SOURCES.txt +0 -0
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic.egg-info/dependency_links.txt +0 -0
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic.egg-info/requires.txt +0 -0
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic.egg-info/top_level.txt +0 -0
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/dqlmagic.egg-info/zip-safe +0 -0
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/pyproject.toml +0 -0
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/setup.cfg +0 -0
- {dqlmagic-1.3.2 → dqlmagic-1.4.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dqlmagic
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: IPython magic function for Dynatrace Query Language (DQL)
|
|
5
5
|
Home-page: https://github.com/dtPaTh/Dqlmagic
|
|
6
6
|
Author: Patrick Thurner
|
|
@@ -62,44 +62,41 @@ df.head()
|
|
|
62
62
|
Same as ```%dql``` or ```%%dql```, but returns instead of the result records the full API response json
|
|
63
63
|
|
|
64
64
|
### %auth_grail <config_prefix>
|
|
65
|
-
Inline function connecting to the grail cluster.
|
|
65
|
+
Inline function connecting to the grail cluster. Supports authentication via [OAuth clients
|
|
66
|
+
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth) and [platform token](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/platform-tokens).
|
|
66
67
|
|
|
67
68
|
Reads connection parameters from .env file:
|
|
68
69
|
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
72
|
-
dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
73
|
-
dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
74
|
-
|
|
70
|
+
# Tenant & API config
|
|
75
71
|
dt_tenant="<YOUR-TENANT-ID>"
|
|
76
72
|
grail_apiurl="https://<YOUR-TENANT-ID>.live.dynatrace.com/api/v2/dql/query"
|
|
73
|
+
|
|
74
|
+
# Platform Token
|
|
75
|
+
dt_platform_token="<YOUR-PLATFORM-TOKEN>"
|
|
76
|
+
|
|
77
|
+
# or OAuth
|
|
78
|
+
# dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
79
|
+
# dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
80
|
+
# dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
81
|
+
# dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
82
|
+
|
|
77
83
|
```
|
|
78
84
|
|
|
79
85
|
The ```<config_prefix>``` is **optional** to be used if you have multiple configs stored in your .env file like e.g.
|
|
80
86
|
|
|
81
87
|
```
|
|
88
|
+
# Default config
|
|
82
89
|
dt_config_prefix="DEV"
|
|
83
90
|
|
|
84
|
-
DEV_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
85
|
-
DEV_dt_oauth_clientid="<YOUR-DEV-CLIENT-ID>"
|
|
86
|
-
DEV_dt_oauth_clientsecret="<YOUR-DEV-CLIENT-SECRET>"
|
|
87
|
-
DEV_dt_oauth_scope="<YOUR-DEV-ACCESS-SCOPE>"
|
|
88
91
|
DEV_dt_tenant="<YOUR-DEV-TENANT-ID>"
|
|
89
|
-
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.
|
|
92
|
+
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.dynatrace.com/platform/storage/query/v1/"
|
|
93
|
+
DEV_dt_platform_token="<YOUR-DEV-PLATFORM-TOKEN>"
|
|
90
94
|
|
|
91
|
-
PROD_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
92
|
-
PROD_dt_oauth_clientid="<YOUR-PROD-CLIENT-ID>"
|
|
93
|
-
PROD_dt_oauth_clientsecret="<YOUR-PROD-CLIENT-SECRET>"
|
|
94
|
-
PROD_dt_oauth_scope="<YOUR-PROD-ACCESS-SCOPE>"
|
|
95
95
|
PROD_dt_tenant="<YOUR-PROD-TENANT-ID>"
|
|
96
|
-
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.
|
|
97
|
-
|
|
96
|
+
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.dynatrace.com/platform/storage/query/v1/"
|
|
97
|
+
PROD_dt_platform_token="<YOUR-PROD-PLATFORM-TOKEN>"
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
With the parameter ```dt_config_prefix```, you set the default config prefix used, if %auth_grail parameter ```<config_prefix>``` is not provided.
|
|
101
101
|
|
|
102
|
-
For more details on how to setup API oauth clients in Dynatrace see [Configure and manage account API OAuth clients
|
|
103
|
-
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth)
|
|
104
|
-
|
|
105
102
|
For more details on .env file see [How to NOT embedded credential in Jupyter notebook](https://yuthakarn.medium.com/how-to-not-show-credential-in-jupyter-notebook-c349f9278466) or [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
__version__='1.
|
|
2
|
-
|
|
3
|
-
from .dqlmagic import DQLmagic
|
|
4
|
-
|
|
5
|
-
def load_ipython_extension(ipython):
|
|
1
|
+
__version__='1.4.0'
|
|
2
|
+
|
|
3
|
+
from .dqlmagic import DQLmagic
|
|
4
|
+
|
|
5
|
+
def load_ipython_extension(ipython):
|
|
6
6
|
ipython.register_magics(DQLmagic)
|
|
@@ -17,6 +17,8 @@ class DQLmagic(Magics):
|
|
|
17
17
|
oauth_clientsecret = None
|
|
18
18
|
oauth_scope = None
|
|
19
19
|
|
|
20
|
+
platform_token = None
|
|
21
|
+
|
|
20
22
|
access_token = None
|
|
21
23
|
grail_apiurl = None
|
|
22
24
|
dt_tenant = None
|
|
@@ -28,8 +30,10 @@ class DQLmagic(Magics):
|
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
def get_bearer(self):
|
|
31
|
-
|
|
32
|
-
if self.
|
|
33
|
+
|
|
34
|
+
if self.platform_token is not None:
|
|
35
|
+
self.access_token = self.platform_token
|
|
36
|
+
elif self.oauth_url is None or self.oauth_clientid is None or self.oauth_clientsecret is None or self.oauth_scope is None:
|
|
33
37
|
self.access_token = None
|
|
34
38
|
else:
|
|
35
39
|
payload = "grant_type=client_credentials&client_id="+self.oauth_clientid+"&client_secret="+self.oauth_clientsecret+"&scope="+self.oauth_scope
|
|
@@ -64,11 +68,13 @@ class DQLmagic(Magics):
|
|
|
64
68
|
self.oauth_clientid = os.getenv(self.config_prefix+'dt_oauth_clientid')
|
|
65
69
|
self.oauth_clientsecret = os.getenv(self.config_prefix+'dt_oauth_clientsecret')
|
|
66
70
|
self.oauth_scope = os.getenv(self.config_prefix+'dt_oauth_scope')
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if self.
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
self.platform_token = os.getenv(self.config_prefix+'dt_platform_token')
|
|
72
|
+
|
|
73
|
+
if self.platform_token is None:
|
|
74
|
+
if self.oauth_url is None: return "Missing connection parameter 'dt_oauth_url' (or 'dt_platform_token')"
|
|
75
|
+
if self.oauth_clientid is None: return "Missing connection parameter 'oauth_clientid'"
|
|
76
|
+
if self.oauth_clientsecret is None: return "Missing connection parameter 'oauth_clientsecret'"
|
|
77
|
+
if self.oauth_scope is None: return "Missing connection parameter 'oauth_scope'"
|
|
72
78
|
|
|
73
79
|
self.grail_apiurl = os.getenv(self.config_prefix+'grail_apiurl')
|
|
74
80
|
self.dt_tenant = os.getenv(self.config_prefix+"dt_tenant")
|
|
@@ -93,6 +99,8 @@ class DQLmagic(Magics):
|
|
|
93
99
|
|
|
94
100
|
if self.access_token is None:
|
|
95
101
|
return "Couldn't successfully authenticate"
|
|
102
|
+
elif self.platform_token is not None:
|
|
103
|
+
return "Using platform token (validated on first query)"
|
|
96
104
|
else:
|
|
97
105
|
return "Successfully authenticated"
|
|
98
106
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dqlmagic
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: IPython magic function for Dynatrace Query Language (DQL)
|
|
5
5
|
Home-page: https://github.com/dtPaTh/Dqlmagic
|
|
6
6
|
Author: Patrick Thurner
|
|
@@ -62,44 +62,41 @@ df.head()
|
|
|
62
62
|
Same as ```%dql``` or ```%%dql```, but returns instead of the result records the full API response json
|
|
63
63
|
|
|
64
64
|
### %auth_grail <config_prefix>
|
|
65
|
-
Inline function connecting to the grail cluster.
|
|
65
|
+
Inline function connecting to the grail cluster. Supports authentication via [OAuth clients
|
|
66
|
+
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth) and [platform token](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/platform-tokens).
|
|
66
67
|
|
|
67
68
|
Reads connection parameters from .env file:
|
|
68
69
|
```
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
72
|
-
dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
73
|
-
dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
74
|
-
|
|
70
|
+
# Tenant & API config
|
|
75
71
|
dt_tenant="<YOUR-TENANT-ID>"
|
|
76
72
|
grail_apiurl="https://<YOUR-TENANT-ID>.live.dynatrace.com/api/v2/dql/query"
|
|
73
|
+
|
|
74
|
+
# Platform Token
|
|
75
|
+
dt_platform_token="<YOUR-PLATFORM-TOKEN>"
|
|
76
|
+
|
|
77
|
+
# or OAuth
|
|
78
|
+
# dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
79
|
+
# dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
80
|
+
# dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
81
|
+
# dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
82
|
+
|
|
77
83
|
```
|
|
78
84
|
|
|
79
85
|
The ```<config_prefix>``` is **optional** to be used if you have multiple configs stored in your .env file like e.g.
|
|
80
86
|
|
|
81
87
|
```
|
|
88
|
+
# Default config
|
|
82
89
|
dt_config_prefix="DEV"
|
|
83
90
|
|
|
84
|
-
DEV_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
85
|
-
DEV_dt_oauth_clientid="<YOUR-DEV-CLIENT-ID>"
|
|
86
|
-
DEV_dt_oauth_clientsecret="<YOUR-DEV-CLIENT-SECRET>"
|
|
87
|
-
DEV_dt_oauth_scope="<YOUR-DEV-ACCESS-SCOPE>"
|
|
88
91
|
DEV_dt_tenant="<YOUR-DEV-TENANT-ID>"
|
|
89
|
-
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.
|
|
92
|
+
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.dynatrace.com/platform/storage/query/v1/"
|
|
93
|
+
DEV_dt_platform_token="<YOUR-DEV-PLATFORM-TOKEN>"
|
|
90
94
|
|
|
91
|
-
PROD_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
92
|
-
PROD_dt_oauth_clientid="<YOUR-PROD-CLIENT-ID>"
|
|
93
|
-
PROD_dt_oauth_clientsecret="<YOUR-PROD-CLIENT-SECRET>"
|
|
94
|
-
PROD_dt_oauth_scope="<YOUR-PROD-ACCESS-SCOPE>"
|
|
95
95
|
PROD_dt_tenant="<YOUR-PROD-TENANT-ID>"
|
|
96
|
-
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.
|
|
97
|
-
|
|
96
|
+
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.dynatrace.com/platform/storage/query/v1/"
|
|
97
|
+
PROD_dt_platform_token="<YOUR-PROD-PLATFORM-TOKEN>"
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
With the parameter ```dt_config_prefix```, you set the default config prefix used, if %auth_grail parameter ```<config_prefix>``` is not provided.
|
|
101
101
|
|
|
102
|
-
For more details on how to setup API oauth clients in Dynatrace see [Configure and manage account API OAuth clients
|
|
103
|
-
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth)
|
|
104
|
-
|
|
105
102
|
For more details on .env file see [How to NOT embedded credential in Jupyter notebook](https://yuthakarn.medium.com/how-to-not-show-credential-in-jupyter-notebook-c349f9278466) or [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
@@ -46,44 +46,41 @@ df.head()
|
|
|
46
46
|
Same as ```%dql``` or ```%%dql```, but returns instead of the result records the full API response json
|
|
47
47
|
|
|
48
48
|
### %auth_grail <config_prefix>
|
|
49
|
-
Inline function connecting to the grail cluster.
|
|
49
|
+
Inline function connecting to the grail cluster. Supports authentication via [OAuth clients
|
|
50
|
+
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth) and [platform token](https://docs.dynatrace.com/docs/manage/identity-access-management/access-tokens-and-oauth-clients/platform-tokens).
|
|
50
51
|
|
|
51
52
|
Reads connection parameters from .env file:
|
|
52
53
|
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
56
|
-
dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
57
|
-
dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
58
|
-
|
|
54
|
+
# Tenant & API config
|
|
59
55
|
dt_tenant="<YOUR-TENANT-ID>"
|
|
60
56
|
grail_apiurl="https://<YOUR-TENANT-ID>.live.dynatrace.com/api/v2/dql/query"
|
|
57
|
+
|
|
58
|
+
# Platform Token
|
|
59
|
+
dt_platform_token="<YOUR-PLATFORM-TOKEN>"
|
|
60
|
+
|
|
61
|
+
# or OAuth
|
|
62
|
+
# dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
63
|
+
# dt_oauth_clientid="<YOUR-CLIENT-ID>"
|
|
64
|
+
# dt_oauth_clientsecret="<YOUR-CLIENT-SECRET>"
|
|
65
|
+
# dt_oauth_scope="<YOUR-ACCESS-SCOPE>"
|
|
66
|
+
|
|
61
67
|
```
|
|
62
68
|
|
|
63
69
|
The ```<config_prefix>``` is **optional** to be used if you have multiple configs stored in your .env file like e.g.
|
|
64
70
|
|
|
65
71
|
```
|
|
72
|
+
# Default config
|
|
66
73
|
dt_config_prefix="DEV"
|
|
67
74
|
|
|
68
|
-
DEV_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
69
|
-
DEV_dt_oauth_clientid="<YOUR-DEV-CLIENT-ID>"
|
|
70
|
-
DEV_dt_oauth_clientsecret="<YOUR-DEV-CLIENT-SECRET>"
|
|
71
|
-
DEV_dt_oauth_scope="<YOUR-DEV-ACCESS-SCOPE>"
|
|
72
75
|
DEV_dt_tenant="<YOUR-DEV-TENANT-ID>"
|
|
73
|
-
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.
|
|
76
|
+
DEV_grail_apiurl="https://<YOUR-DEV-TENANT-ID>.apps.dynatrace.com/platform/storage/query/v1/"
|
|
77
|
+
DEV_dt_platform_token="<YOUR-DEV-PLATFORM-TOKEN>"
|
|
74
78
|
|
|
75
|
-
PROD_dt_oauth_url="https://sso.dynatrace.com/sso/oauth2/token"
|
|
76
|
-
PROD_dt_oauth_clientid="<YOUR-PROD-CLIENT-ID>"
|
|
77
|
-
PROD_dt_oauth_clientsecret="<YOUR-PROD-CLIENT-SECRET>"
|
|
78
|
-
PROD_dt_oauth_scope="<YOUR-PROD-ACCESS-SCOPE>"
|
|
79
79
|
PROD_dt_tenant="<YOUR-PROD-TENANT-ID>"
|
|
80
|
-
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.
|
|
81
|
-
|
|
80
|
+
PROD_grail_apiurl="https://<YOUR-PROD-TENANT-ID>.apps.dynatrace.com/platform/storage/query/v1/"
|
|
81
|
+
PROD_dt_platform_token="<YOUR-PROD-PLATFORM-TOKEN>"
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
With the parameter ```dt_config_prefix```, you set the default config prefix used, if %auth_grail parameter ```<config_prefix>``` is not provided.
|
|
85
85
|
|
|
86
|
-
For more details on how to setup API oauth clients in Dynatrace see [Configure and manage account API OAuth clients
|
|
87
|
-
](https://www.dynatrace.com/support/help/how-to-use-dynatrace/account-management/identity-access-management/account-api-oauth)
|
|
88
|
-
|
|
89
86
|
For more details on .env file see [How to NOT embedded credential in Jupyter notebook](https://yuthakarn.medium.com/how-to-not-show-credential-in-jupyter-notebook-c349f9278466) or [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|