meerschaum 2.9.5__py3-none-any.whl → 3.0.0rc1__py3-none-any.whl
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.
- meerschaum/__init__.py +5 -2
- meerschaum/_internal/__init__.py +1 -0
- meerschaum/_internal/arguments/_parse_arguments.py +4 -4
- meerschaum/_internal/arguments/_parser.py +17 -1
- meerschaum/_internal/entry.py +6 -6
- meerschaum/_internal/shell/Shell.py +1 -1
- meerschaum/_internal/static.py +372 -0
- meerschaum/actions/api.py +12 -2
- meerschaum/actions/bootstrap.py +7 -7
- meerschaum/actions/edit.py +142 -18
- meerschaum/actions/register.py +137 -6
- meerschaum/actions/show.py +117 -29
- meerschaum/actions/stop.py +4 -1
- meerschaum/actions/sync.py +1 -1
- meerschaum/actions/tag.py +9 -8
- meerschaum/api/__init__.py +9 -2
- meerschaum/api/_events.py +39 -2
- meerschaum/api/_oauth2.py +118 -8
- meerschaum/api/_tokens.py +102 -0
- meerschaum/api/dash/__init__.py +0 -1
- meerschaum/api/dash/callbacks/custom.py +2 -2
- meerschaum/api/dash/callbacks/dashboard.py +102 -18
- meerschaum/api/dash/callbacks/plugins.py +0 -1
- meerschaum/api/dash/callbacks/register.py +1 -1
- meerschaum/api/dash/callbacks/settings/__init__.py +1 -0
- meerschaum/api/dash/callbacks/settings/password_reset.py +2 -2
- meerschaum/api/dash/callbacks/settings/tokens.py +388 -0
- meerschaum/api/dash/components.py +30 -8
- meerschaum/api/dash/keys.py +19 -93
- meerschaum/api/dash/pages/dashboard.py +1 -20
- meerschaum/api/dash/pages/settings/__init__.py +1 -0
- meerschaum/api/dash/pages/settings/password_reset.py +1 -1
- meerschaum/api/dash/pages/settings/tokens.py +55 -0
- meerschaum/api/dash/pipes.py +94 -59
- meerschaum/api/dash/sessions.py +12 -0
- meerschaum/api/dash/tokens.py +606 -0
- meerschaum/api/dash/websockets.py +1 -1
- meerschaum/api/dash/webterm.py +4 -0
- meerschaum/api/models/__init__.py +23 -3
- meerschaum/api/models/_actions.py +22 -0
- meerschaum/api/models/_pipes.py +85 -7
- meerschaum/api/models/_tokens.py +81 -0
- meerschaum/api/resources/templates/termpage.html +12 -0
- meerschaum/api/routes/__init__.py +1 -0
- meerschaum/api/routes/_actions.py +3 -4
- meerschaum/api/routes/_connectors.py +3 -7
- meerschaum/api/routes/_jobs.py +14 -35
- meerschaum/api/routes/_login.py +49 -12
- meerschaum/api/routes/_misc.py +5 -10
- meerschaum/api/routes/_pipes.py +134 -111
- meerschaum/api/routes/_plugins.py +38 -28
- meerschaum/api/routes/_tokens.py +236 -0
- meerschaum/api/routes/_users.py +47 -35
- meerschaum/api/routes/_version.py +3 -3
- meerschaum/config/__init__.py +43 -20
- meerschaum/config/_default.py +32 -5
- meerschaum/config/_edit.py +28 -24
- meerschaum/config/_environment.py +1 -1
- meerschaum/config/_patch.py +6 -6
- meerschaum/config/_paths.py +5 -1
- meerschaum/config/_read_config.py +65 -34
- meerschaum/config/_sync.py +6 -3
- meerschaum/config/_version.py +1 -1
- meerschaum/config/stack/__init__.py +24 -5
- meerschaum/config/static.py +18 -0
- meerschaum/connectors/_Connector.py +10 -4
- meerschaum/connectors/__init__.py +4 -20
- meerschaum/connectors/api/_APIConnector.py +34 -6
- meerschaum/connectors/api/_actions.py +2 -2
- meerschaum/connectors/api/_jobs.py +1 -1
- meerschaum/connectors/api/_login.py +33 -7
- meerschaum/connectors/api/_misc.py +2 -2
- meerschaum/connectors/api/_pipes.py +15 -14
- meerschaum/connectors/api/_plugins.py +2 -2
- meerschaum/connectors/api/_request.py +1 -1
- meerschaum/connectors/api/_tokens.py +146 -0
- meerschaum/connectors/api/_users.py +70 -58
- meerschaum/connectors/instance/_InstanceConnector.py +83 -0
- meerschaum/connectors/instance/__init__.py +10 -0
- meerschaum/connectors/instance/_pipes.py +442 -0
- meerschaum/connectors/instance/_plugins.py +151 -0
- meerschaum/connectors/instance/_tokens.py +296 -0
- meerschaum/connectors/instance/_users.py +181 -0
- meerschaum/connectors/parse.py +4 -1
- meerschaum/connectors/sql/_SQLConnector.py +8 -5
- meerschaum/connectors/sql/_cli.py +12 -11
- meerschaum/connectors/sql/_create_engine.py +6 -154
- meerschaum/connectors/sql/_fetch.py +2 -18
- meerschaum/connectors/sql/_pipes.py +42 -31
- meerschaum/connectors/sql/_plugins.py +29 -0
- meerschaum/connectors/sql/_sql.py +8 -1
- meerschaum/connectors/sql/_users.py +29 -2
- meerschaum/connectors/sql/tables/__init__.py +1 -1
- meerschaum/connectors/valkey/_ValkeyConnector.py +2 -4
- meerschaum/connectors/valkey/_pipes.py +9 -10
- meerschaum/connectors/valkey/_plugins.py +2 -26
- meerschaum/core/Pipe/__init__.py +31 -14
- meerschaum/core/Pipe/_attributes.py +156 -58
- meerschaum/core/Pipe/_bootstrap.py +54 -24
- meerschaum/core/Pipe/_data.py +41 -1
- meerschaum/core/Pipe/_dtypes.py +29 -14
- meerschaum/core/Pipe/_edit.py +12 -4
- meerschaum/core/Pipe/_show.py +5 -5
- meerschaum/core/Pipe/_sync.py +48 -53
- meerschaum/core/Pipe/_verify.py +1 -1
- meerschaum/{plugins → core/Plugin}/_Plugin.py +9 -11
- meerschaum/core/Plugin/__init__.py +1 -1
- meerschaum/core/Token/_Token.py +221 -0
- meerschaum/core/Token/__init__.py +12 -0
- meerschaum/core/User/_User.py +34 -8
- meerschaum/core/User/__init__.py +9 -1
- meerschaum/core/__init__.py +1 -0
- meerschaum/jobs/_Job.py +3 -2
- meerschaum/jobs/__init__.py +3 -2
- meerschaum/jobs/systemd.py +1 -1
- meerschaum/models/__init__.py +35 -0
- meerschaum/models/pipes.py +247 -0
- meerschaum/models/tokens.py +38 -0
- meerschaum/models/users.py +26 -0
- meerschaum/plugins/__init__.py +22 -7
- meerschaum/plugins/bootstrap.py +2 -1
- meerschaum/utils/_get_pipes.py +68 -27
- meerschaum/utils/daemon/Daemon.py +2 -1
- meerschaum/utils/daemon/__init__.py +30 -2
- meerschaum/utils/dataframe.py +95 -14
- meerschaum/utils/dtypes/__init__.py +91 -18
- meerschaum/utils/dtypes/sql.py +44 -0
- meerschaum/utils/formatting/__init__.py +1 -1
- meerschaum/utils/formatting/_pipes.py +5 -4
- meerschaum/utils/formatting/_shell.py +11 -9
- meerschaum/utils/misc.py +237 -80
- meerschaum/utils/packages/__init__.py +3 -6
- meerschaum/utils/packages/_packages.py +34 -32
- meerschaum/utils/pipes.py +181 -0
- meerschaum/utils/process.py +1 -1
- meerschaum/utils/prompt.py +3 -1
- meerschaum/utils/schedule.py +1 -0
- meerschaum/utils/sql.py +114 -37
- meerschaum/utils/typing.py +1 -4
- meerschaum/utils/venv/_Venv.py +2 -2
- meerschaum/utils/venv/__init__.py +5 -7
- {meerschaum-2.9.5.dist-info → meerschaum-3.0.0rc1.dist-info}/METADATA +88 -80
- meerschaum-3.0.0rc1.dist-info/RECORD +282 -0
- {meerschaum-2.9.5.dist-info → meerschaum-3.0.0rc1.dist-info}/WHEEL +1 -1
- meerschaum/api/models/_interfaces.py +0 -15
- meerschaum/api/models/_locations.py +0 -15
- meerschaum/api/models/_metrics.py +0 -15
- meerschaum/config/static/__init__.py +0 -186
- meerschaum-2.9.5.dist-info/RECORD +0 -263
- {meerschaum-2.9.5.dist-info → meerschaum-3.0.0rc1.dist-info}/entry_points.txt +0 -0
- {meerschaum-2.9.5.dist-info → meerschaum-3.0.0rc1.dist-info}/licenses/LICENSE +0 -0
- {meerschaum-2.9.5.dist-info → meerschaum-3.0.0rc1.dist-info}/top_level.txt +0 -0
- {meerschaum-2.9.5.dist-info → meerschaum-3.0.0rc1.dist-info}/zip-safe +0 -0
meerschaum/__init__.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# vim:fenc=utf-8
|
4
4
|
|
5
5
|
"""
|
6
|
-
Copyright
|
6
|
+
Copyright 2025 Bennett Meares
|
7
7
|
|
8
8
|
Licensed under the Apache License, Version 2.0 (the "License");
|
9
9
|
you may not use this file except in compliance with the License.
|
@@ -19,13 +19,14 @@ limitations under the License.
|
|
19
19
|
"""
|
20
20
|
|
21
21
|
import atexit
|
22
|
+
|
22
23
|
from meerschaum.utils.typing import SuccessTuple
|
23
24
|
from meerschaum.utils.packages import attempt_import
|
24
25
|
from meerschaum.core.Pipe import Pipe
|
25
26
|
from meerschaum.plugins import Plugin
|
26
27
|
from meerschaum.utils.venv import Venv
|
27
28
|
from meerschaum.jobs import Job, make_executor
|
28
|
-
from meerschaum.connectors import get_connector, Connector, make_connector
|
29
|
+
from meerschaum.connectors import get_connector, Connector, InstanceConnector, make_connector
|
29
30
|
from meerschaum.utils import get_pipes
|
30
31
|
from meerschaum.utils.formatting import pprint
|
31
32
|
from meerschaum._internal.docs import index as __doc__
|
@@ -42,6 +43,7 @@ __all__ = (
|
|
42
43
|
"get_config",
|
43
44
|
"Pipe",
|
44
45
|
"Plugin",
|
46
|
+
"SuccessTuple",
|
45
47
|
"Venv",
|
46
48
|
"Plugin",
|
47
49
|
"Job",
|
@@ -55,6 +57,7 @@ __all__ = (
|
|
55
57
|
"utils",
|
56
58
|
"SuccessTuple",
|
57
59
|
"Connector",
|
60
|
+
"InstanceConnector",
|
58
61
|
"make_connector",
|
59
62
|
"entry",
|
60
63
|
)
|
meerschaum/_internal/__init__.py
CHANGED
@@ -23,7 +23,7 @@ def split_pipeline_sysargs(sysargs: List[str]) -> Tuple[List[str], List[str]]:
|
|
23
23
|
"""
|
24
24
|
Split `sysargs` into the main pipeline and the flags following the pipeline separator (`:`).
|
25
25
|
"""
|
26
|
-
from meerschaum.
|
26
|
+
from meerschaum._internal.static import STATIC_CONFIG
|
27
27
|
pipeline_key = STATIC_CONFIG['system']['arguments']['pipeline_key']
|
28
28
|
if pipeline_key not in sysargs:
|
29
29
|
return sysargs, []
|
@@ -40,7 +40,7 @@ def split_chained_sysargs(sysargs: List[str]) -> List[List[str]]:
|
|
40
40
|
Split a `sysargs` list containing "and" keys (`+`)
|
41
41
|
into a list of individual `sysargs`.
|
42
42
|
"""
|
43
|
-
from meerschaum.
|
43
|
+
from meerschaum._internal.static import STATIC_CONFIG
|
44
44
|
and_key = STATIC_CONFIG['system']['arguments']['and_key']
|
45
45
|
|
46
46
|
if not sysargs or and_key not in sysargs:
|
@@ -90,7 +90,7 @@ def parse_arguments(sysargs: List[str]) -> Dict[str, Any]:
|
|
90
90
|
|
91
91
|
"""
|
92
92
|
import shlex
|
93
|
-
from meerschaum.
|
93
|
+
from meerschaum._internal.static import STATIC_CONFIG
|
94
94
|
from meerschaum._internal.arguments._parser import parser
|
95
95
|
|
96
96
|
global _loaded_plugins_args
|
@@ -360,7 +360,7 @@ def remove_leading_action(
|
|
360
360
|
"""
|
361
361
|
from meerschaum.actions import get_action, get_main_action_name
|
362
362
|
from meerschaum.utils.warnings import warn
|
363
|
-
from meerschaum.
|
363
|
+
from meerschaum._internal.static import STATIC_CONFIG
|
364
364
|
action_function = get_action(action, _actions=_actions)
|
365
365
|
if action_function is None:
|
366
366
|
return action
|
@@ -195,6 +195,7 @@ groups['pipes'] = parser.add_argument_group(title='Pipes options')
|
|
195
195
|
groups['sync'] = parser.add_argument_group(title='Sync options')
|
196
196
|
groups['api'] = parser.add_argument_group(title='API options')
|
197
197
|
groups['plugins'] = parser.add_argument_group(title='Plugins options')
|
198
|
+
groups['tokens'] = parser.add_argument_group(title='Tokens options')
|
198
199
|
groups['packages'] = parser.add_argument_group(title='Packages options')
|
199
200
|
groups['debug'] = parser.add_argument_group(title='Debugging options')
|
200
201
|
groups['misc'] = parser.add_argument_group(title='Miscellaneous options')
|
@@ -393,7 +394,11 @@ groups['api'].add_argument(
|
|
393
394
|
)
|
394
395
|
groups['api'].add_argument(
|
395
396
|
'--no-dash', '--nodash', action='store_true',
|
396
|
-
help = 'When starting the API, do not start the Web
|
397
|
+
help = 'When starting the API, do not start the Web Console dashboard.',
|
398
|
+
)
|
399
|
+
groups['api'].add_argument(
|
400
|
+
'--no-webterm', '--nowebterm', action='store_true',
|
401
|
+
help="When starting the API, do not start the Webterm.",
|
397
402
|
)
|
398
403
|
groups['api'].add_argument(
|
399
404
|
'--private', '--private-mode', action='store_true',
|
@@ -419,12 +424,23 @@ groups['api'].add_argument(
|
|
419
424
|
'--certfile', type=str,
|
420
425
|
help = "Start the API server with this certfile (requires --keyfile).",
|
421
426
|
)
|
427
|
+
|
422
428
|
### Plugins options
|
423
429
|
groups['plugins'].add_argument(
|
424
430
|
'-r', '--repository', '--repo', type=str,
|
425
431
|
help="Meerschaum plugins repository to connect to. Specify an API label (default: 'mrsm')"
|
426
432
|
)
|
427
433
|
|
434
|
+
### Tokens options
|
435
|
+
groups['tokens'].add_argument(
|
436
|
+
'--ttl-days', type=int,
|
437
|
+
help="For how many days should a token be valid.",
|
438
|
+
)
|
439
|
+
groups['tokens'].add_argument(
|
440
|
+
'--scopes', '--scope', nargs='+',
|
441
|
+
help="Which scope permissions to grant to a token.",
|
442
|
+
)
|
443
|
+
|
428
444
|
### Packages options
|
429
445
|
groups['packages'].add_argument(
|
430
446
|
'--venv', type=str,
|
meerschaum/_internal/entry.py
CHANGED
@@ -15,7 +15,7 @@ import pathlib
|
|
15
15
|
|
16
16
|
import meerschaum as mrsm
|
17
17
|
from meerschaum.utils.typing import SuccessTuple, List, Optional, Dict, Callable, Any
|
18
|
-
from meerschaum.
|
18
|
+
from meerschaum._internal.static import STATIC_CONFIG as _STATIC_CONFIG
|
19
19
|
|
20
20
|
_systemd_result_path = None
|
21
21
|
if (_STATIC_CONFIG['environment']['systemd_log_path']) in os.environ:
|
@@ -66,7 +66,7 @@ def entry(
|
|
66
66
|
sysargs_has_api_executor_keys,
|
67
67
|
get_pipeline_sysargs,
|
68
68
|
)
|
69
|
-
from meerschaum.
|
69
|
+
from meerschaum._internal.static import STATIC_CONFIG
|
70
70
|
if sysargs is None:
|
71
71
|
sysargs = []
|
72
72
|
if not isinstance(sysargs, list):
|
@@ -206,7 +206,7 @@ def entry_with_args(
|
|
206
206
|
from meerschaum.actions import get_action
|
207
207
|
from meerschaum._internal.arguments import remove_leading_action
|
208
208
|
from meerschaum.utils.venv import active_venvs, deactivate_venv
|
209
|
-
from meerschaum.
|
209
|
+
from meerschaum._internal.static import STATIC_CONFIG
|
210
210
|
from meerschaum.utils.typing import is_success_tuple
|
211
211
|
|
212
212
|
if _patch_args:
|
@@ -325,9 +325,9 @@ def _do_action_wrapper(
|
|
325
325
|
import traceback
|
326
326
|
traceback.print_exception(type(e), e, e.__traceback__)
|
327
327
|
result = False, (
|
328
|
-
f"Failed to execute `{action_name}` "
|
329
|
-
+ "with
|
330
|
-
f
|
328
|
+
f"Failed to execute `{action_name.strip()}` "
|
329
|
+
+ f"with `{type(e).__name__}`"
|
330
|
+
+ (f':\n\n{e}' if str(e) else '.')
|
331
331
|
+ (
|
332
332
|
"\n\nRun again with '--debug' to see a full stacktrace."
|
333
333
|
if not kw.get('debug', False) else ''
|
@@ -35,7 +35,7 @@ _clear_screen = get_config('shell', 'clear_screen', patch=True)
|
|
35
35
|
from meerschaum.utils.misc import string_width, remove_ansi
|
36
36
|
from meerschaum.utils.warnings import warn
|
37
37
|
from meerschaum.jobs import get_executor_keys_from_context
|
38
|
-
from meerschaum.
|
38
|
+
from meerschaum._internal.static import STATIC_CONFIG
|
39
39
|
from meerschaum._internal.arguments._parse_arguments import (
|
40
40
|
split_chained_sysargs,
|
41
41
|
split_pipeline_sysargs,
|
@@ -0,0 +1,372 @@
|
|
1
|
+
#! /usr/bin/env python3
|
2
|
+
# vim:fenc=utf-8
|
3
|
+
|
4
|
+
"""
|
5
|
+
Define internal static config (formerly `meerschaum.config.static`).
|
6
|
+
"""
|
7
|
+
|
8
|
+
import os
|
9
|
+
import random
|
10
|
+
import string
|
11
|
+
from typing import Dict, Any
|
12
|
+
|
13
|
+
__all__ = ('STATIC_CONFIG',)
|
14
|
+
|
15
|
+
_default_create_engine_args = {
|
16
|
+
# 'method': 'multi',
|
17
|
+
'pool_size': 5,
|
18
|
+
'max_overflow': 10,
|
19
|
+
'pool_recycle': 3600,
|
20
|
+
'connect_args': {},
|
21
|
+
}
|
22
|
+
_default_db_requirements = {
|
23
|
+
'username',
|
24
|
+
'password',
|
25
|
+
'host',
|
26
|
+
'database',
|
27
|
+
}
|
28
|
+
SERVER_ID: str = os.environ.get('MRSM_SERVER_ID', ''.join(random.sample(string.ascii_lowercase+string.digits, 6)))
|
29
|
+
STATIC_CONFIG: Dict[str, Any] = {
|
30
|
+
'api': {
|
31
|
+
'endpoints': {
|
32
|
+
'index': '/',
|
33
|
+
'favicon': '/favicon.ico',
|
34
|
+
'plugins': '/plugins',
|
35
|
+
'pipes': '/pipes',
|
36
|
+
'metadata': '/metadata',
|
37
|
+
'actions': '/actions',
|
38
|
+
'jobs': '/jobs',
|
39
|
+
'logs': '/logs',
|
40
|
+
'users': '/users',
|
41
|
+
'tokens': '/tokens',
|
42
|
+
'login': '/login',
|
43
|
+
'connectors': '/connectors',
|
44
|
+
'version': '/version',
|
45
|
+
'chaining': '/chaining',
|
46
|
+
'websocket': '/ws',
|
47
|
+
'dash': '/dash',
|
48
|
+
'webterm': r'/webterm/{session_id}',
|
49
|
+
'webterm_websocket': r'/websocket/{session_id}',
|
50
|
+
'info': '/info',
|
51
|
+
'healthcheck': '/healthcheck',
|
52
|
+
'docs': '/docs',
|
53
|
+
'redoc': '/redoc',
|
54
|
+
'openapi': '/openapi.json',
|
55
|
+
},
|
56
|
+
'oauth': {
|
57
|
+
'token_expires_minutes': 720,
|
58
|
+
},
|
59
|
+
'webterm_job_name': '_webterm',
|
60
|
+
'default_timeout': 600,
|
61
|
+
'jobs': {
|
62
|
+
'stdin_message': 'MRSM_STDIN',
|
63
|
+
'stop_message': 'MRSM_STOP',
|
64
|
+
'metadata_cache_seconds': 5,
|
65
|
+
'temp_prefix': '.api-temp-',
|
66
|
+
},
|
67
|
+
},
|
68
|
+
'sql': {
|
69
|
+
'internal_schema': '_mrsm_internal',
|
70
|
+
'instance_schema': 'mrsm',
|
71
|
+
'default_create_engine_args': _default_create_engine_args,
|
72
|
+
'create_engine_flavors': {
|
73
|
+
'timescaledb': {
|
74
|
+
'engine': 'postgresql+psycopg',
|
75
|
+
'create_engine': _default_create_engine_args,
|
76
|
+
'omit_create_engine': {'method',},
|
77
|
+
'to_sql': {},
|
78
|
+
'requirements': _default_db_requirements,
|
79
|
+
'defaults': {
|
80
|
+
'port': 5432,
|
81
|
+
},
|
82
|
+
},
|
83
|
+
'timescaledb-ha': {
|
84
|
+
'engine': 'postgresql+psycopg',
|
85
|
+
'create_engine': _default_create_engine_args,
|
86
|
+
'omit_create_engine': {'method',},
|
87
|
+
'to_sql': {},
|
88
|
+
'requirements': _default_db_requirements,
|
89
|
+
'defaults': {
|
90
|
+
'port': 5432,
|
91
|
+
},
|
92
|
+
},
|
93
|
+
'postgresql': {
|
94
|
+
'engine': 'postgresql+psycopg',
|
95
|
+
'create_engine': _default_create_engine_args,
|
96
|
+
'omit_create_engine': {'method',},
|
97
|
+
'to_sql': {},
|
98
|
+
'requirements': _default_db_requirements,
|
99
|
+
'defaults': {
|
100
|
+
'port': 5432,
|
101
|
+
},
|
102
|
+
},
|
103
|
+
'postgis': {
|
104
|
+
'engine': 'postgresql+psycopg',
|
105
|
+
'create_engine': _default_create_engine_args,
|
106
|
+
'omit_create_engine': {'method',},
|
107
|
+
'to_sql': {},
|
108
|
+
'requirements': _default_db_requirements,
|
109
|
+
'defaults': {
|
110
|
+
'port': 5432,
|
111
|
+
},
|
112
|
+
},
|
113
|
+
'citus': {
|
114
|
+
'engine': 'postgresql+psycopg',
|
115
|
+
'create_engine': _default_create_engine_args,
|
116
|
+
'omit_create_engine': {'method',},
|
117
|
+
'to_sql': {},
|
118
|
+
'requirements': _default_db_requirements,
|
119
|
+
'defaults': {
|
120
|
+
'port': 5432,
|
121
|
+
},
|
122
|
+
},
|
123
|
+
'mssql': {
|
124
|
+
'engine': 'mssql+pyodbc',
|
125
|
+
'create_engine': {
|
126
|
+
'fast_executemany': True,
|
127
|
+
'use_insertmanyvalues': False,
|
128
|
+
'isolation_level': 'AUTOCOMMIT',
|
129
|
+
'use_setinputsizes': False,
|
130
|
+
'pool_pre_ping': True,
|
131
|
+
'ignore_no_transaction_on_rollback': True,
|
132
|
+
},
|
133
|
+
'omit_create_engine': {'method',},
|
134
|
+
'to_sql': {
|
135
|
+
'method': None,
|
136
|
+
},
|
137
|
+
'requirements': _default_db_requirements,
|
138
|
+
'defaults': {
|
139
|
+
'port': 1433,
|
140
|
+
'options': (
|
141
|
+
"driver=ODBC Driver 18 for SQL Server"
|
142
|
+
"&UseFMTONLY=Yes"
|
143
|
+
"&TrustServerCertificate=yes"
|
144
|
+
"&Encrypt=no"
|
145
|
+
"&MARS_Connection=yes"
|
146
|
+
),
|
147
|
+
},
|
148
|
+
},
|
149
|
+
'mysql': {
|
150
|
+
'engine': 'mysql+pymysql',
|
151
|
+
'create_engine': _default_create_engine_args,
|
152
|
+
'omit_create_engine': {'method',},
|
153
|
+
'to_sql': {
|
154
|
+
'method': 'multi',
|
155
|
+
},
|
156
|
+
'requirements': _default_db_requirements,
|
157
|
+
'defaults': {
|
158
|
+
'port': 3306,
|
159
|
+
},
|
160
|
+
},
|
161
|
+
'mariadb': {
|
162
|
+
'engine': 'mysql+pymysql',
|
163
|
+
'create_engine': _default_create_engine_args,
|
164
|
+
'omit_create_engine': {'method',},
|
165
|
+
'to_sql': {
|
166
|
+
'method': 'multi',
|
167
|
+
},
|
168
|
+
'requirements': _default_db_requirements,
|
169
|
+
'defaults': {
|
170
|
+
'port': 3306,
|
171
|
+
},
|
172
|
+
},
|
173
|
+
'oracle': {
|
174
|
+
'engine': 'oracle+oracledb',
|
175
|
+
'create_engine': _default_create_engine_args,
|
176
|
+
'omit_create_engine': {'method',},
|
177
|
+
'to_sql': {
|
178
|
+
'method': None,
|
179
|
+
},
|
180
|
+
'requirements': _default_db_requirements,
|
181
|
+
'defaults': {
|
182
|
+
'port': 1521,
|
183
|
+
},
|
184
|
+
},
|
185
|
+
'sqlite': {
|
186
|
+
'engine': 'sqlite',
|
187
|
+
'create_engine': _default_create_engine_args,
|
188
|
+
'omit_create_engine': {'method',},
|
189
|
+
'to_sql': {
|
190
|
+
'method': 'multi',
|
191
|
+
},
|
192
|
+
'requirements': {'database'},
|
193
|
+
'defaults': {},
|
194
|
+
},
|
195
|
+
'duckdb': {
|
196
|
+
'engine': 'duckdb',
|
197
|
+
'create_engine': {},
|
198
|
+
'omit_create_engine': {'ALL',},
|
199
|
+
'to_sql': {
|
200
|
+
'method': 'multi',
|
201
|
+
},
|
202
|
+
'requirements': '',
|
203
|
+
'defaults': {},
|
204
|
+
},
|
205
|
+
'cockroachdb': {
|
206
|
+
'engine': 'cockroachdb',
|
207
|
+
'omit_create_engine': {'method',},
|
208
|
+
'create_engine': _default_create_engine_args,
|
209
|
+
'to_sql': {
|
210
|
+
'method': 'multi',
|
211
|
+
},
|
212
|
+
'requirements': {'host'},
|
213
|
+
'defaults': {
|
214
|
+
'port': 26257,
|
215
|
+
'database': 'defaultdb',
|
216
|
+
'username': 'root',
|
217
|
+
'password': 'admin',
|
218
|
+
},
|
219
|
+
},
|
220
|
+
},
|
221
|
+
},
|
222
|
+
'valkey': {
|
223
|
+
'colon': '-_',
|
224
|
+
},
|
225
|
+
'environment': {
|
226
|
+
'config': 'MRSM_CONFIG',
|
227
|
+
'config_dir': 'MRSM_CONFIG_DIR',
|
228
|
+
'patch': 'MRSM_PATCH',
|
229
|
+
'root': 'MRSM_ROOT_DIR',
|
230
|
+
'plugins': 'MRSM_PLUGINS_DIR',
|
231
|
+
'venvs': 'MRSM_VENVS_DIR',
|
232
|
+
'runtime': 'MRSM_RUNTIME',
|
233
|
+
'work_dir': 'MRSM_WORK_DIR',
|
234
|
+
'user': 'MRSM_USER',
|
235
|
+
'dep_group': 'MRSM_DEP_GROUP',
|
236
|
+
'home': 'MRSM_HOME',
|
237
|
+
'src': 'MRSM_SRC',
|
238
|
+
'uid': 'MRSM_UID',
|
239
|
+
'gid': 'MRSM_GID',
|
240
|
+
'noask': 'MRSM_NOASK',
|
241
|
+
'noninteractive': 'MRSM_NONINTERACTIVE',
|
242
|
+
'id': 'MRSM_SERVER_ID',
|
243
|
+
'daemon_id': 'MRSM_DAEMON_ID',
|
244
|
+
'systemd_log_path': 'MRSM_SYSTEMD_LOG_PATH',
|
245
|
+
'systemd_stdin_path': 'MRSM_SYSTEMD_STDIN_PATH',
|
246
|
+
'systemd_result_path': 'MRSM_SYSTEMD_RESULT_PATH',
|
247
|
+
'systemd_delete_job': 'MRSM_SYSTEMD_DELETE_JOB',
|
248
|
+
'uri_regex': r'MRSM_([a-zA-Z0-9]*)_(\d*[a-zA-Z][a-zA-Z0-9-_+]*$)',
|
249
|
+
'prefix': 'MRSM_',
|
250
|
+
},
|
251
|
+
'config': {
|
252
|
+
'default_filetype': 'json',
|
253
|
+
'symlinks_key': '_symlinks',
|
254
|
+
},
|
255
|
+
'system': {
|
256
|
+
'arguments': {
|
257
|
+
'sub_decorators': (
|
258
|
+
'[',
|
259
|
+
']'
|
260
|
+
),
|
261
|
+
'underscore_standin': '<UNDERSCORE>', ### Temporary replacement for parsing.
|
262
|
+
'failure_key': '_argparse_exception',
|
263
|
+
'and_key': '+',
|
264
|
+
'escaped_and_key': '++',
|
265
|
+
'pipeline_key': ':',
|
266
|
+
'escaped_pipeline_key': '::',
|
267
|
+
},
|
268
|
+
'urls': {
|
269
|
+
'get-pip.py': 'https://bootstrap.pypa.io/get-pip.py',
|
270
|
+
},
|
271
|
+
'success': {
|
272
|
+
'ignore': (
|
273
|
+
'Success',
|
274
|
+
'success'
|
275
|
+
'Succeeded',
|
276
|
+
'',
|
277
|
+
None,
|
278
|
+
),
|
279
|
+
},
|
280
|
+
'prompt': {
|
281
|
+
'web': False,
|
282
|
+
},
|
283
|
+
'fetch_pipes_keys': {
|
284
|
+
'negation_prefix': '_',
|
285
|
+
},
|
286
|
+
},
|
287
|
+
'connectors': {
|
288
|
+
'default_label': 'main',
|
289
|
+
},
|
290
|
+
'stack': {
|
291
|
+
'dollar_standin': '<DOLLAR>', ### Temporary replacement for docker-compose.yaml.
|
292
|
+
},
|
293
|
+
'users': {
|
294
|
+
'password_hash': {
|
295
|
+
'algorithm_name': 'sha256',
|
296
|
+
'salt_bytes': 16,
|
297
|
+
'schemes': [
|
298
|
+
'pbkdf2_sha256',
|
299
|
+
],
|
300
|
+
'default': 'pbkdf2_sha256',
|
301
|
+
'pbkdf2_sha256__default_rounds': 1_000_000,
|
302
|
+
},
|
303
|
+
'min_username_length': 1,
|
304
|
+
'max_username_length': 60,
|
305
|
+
'min_password_length': 5,
|
306
|
+
},
|
307
|
+
'plugins': {
|
308
|
+
'repo_separator': '@',
|
309
|
+
'lock_sleep_total': 1.0,
|
310
|
+
'lock_sleep_increment': 0.1,
|
311
|
+
},
|
312
|
+
'pipes': {
|
313
|
+
'dtypes': {
|
314
|
+
'min_ratio_columns_changed_for_full_astype': 0.5,
|
315
|
+
},
|
316
|
+
'exists_timeout_seconds': 5.0,
|
317
|
+
'static_schema_cache_seconds': 60.0,
|
318
|
+
'max_bound_time_days': 36525,
|
319
|
+
},
|
320
|
+
'jobs': {
|
321
|
+
'check_restart_seconds': 1.0,
|
322
|
+
},
|
323
|
+
'tokens': {
|
324
|
+
'minimum_length': 24,
|
325
|
+
'maximum_length': 32,
|
326
|
+
'hash_rounds': 100_000,
|
327
|
+
'scopes': {
|
328
|
+
'pipes:read': "Read pipes' parameters and the contents of target tables.",
|
329
|
+
'pipes:write': "Update pipes' parameters and sync to target tables.",
|
330
|
+
'pipes:drop': "Drop target tables.",
|
331
|
+
'pipes:delete': "Delete pipes' parameters and drop target tables.",
|
332
|
+
'actions:execute': "Execute arbitrary actions.",
|
333
|
+
'connectors:read': "Read the available connectors.",
|
334
|
+
'jobs:read': "Read jobs' properties",
|
335
|
+
'jobs:write': "Write jobs' properties",
|
336
|
+
'jobs:execute': "Run jobs.",
|
337
|
+
'jobs:delete': "Delete jobs.",
|
338
|
+
'logs:read': "Read jobs' logs.",
|
339
|
+
'jobs:stop': "Stop running jobs.",
|
340
|
+
'jobs:pause': "Pause running jobs.",
|
341
|
+
'instance:read': "Read an instance's system-level metadata.",
|
342
|
+
'instance:chain': "Allow chaining API instances using the associated credentials.",
|
343
|
+
'plugins:write': "Register and update plugins' metadata.",
|
344
|
+
'plugins:read': "Read attributes of registered plugins.",
|
345
|
+
'plugins:delete': "Delete plugins (owned by user) from the repository.",
|
346
|
+
'users:read': "Read metadata about the associated account.",
|
347
|
+
'users:write': "Write metadata for the associated account.",
|
348
|
+
'users:register': "Register new user accounts.",
|
349
|
+
'users:delete': "Delete the associated user account (or other users for admins).",
|
350
|
+
},
|
351
|
+
},
|
352
|
+
'setup': {
|
353
|
+
'name': 'meerschaum',
|
354
|
+
'formal_name': 'Meerschaum',
|
355
|
+
'app_id': 'io.meerschaum',
|
356
|
+
'description': 'Sync Time-Series Pipes with Meerschaum',
|
357
|
+
'url': 'https://meerschaum.io',
|
358
|
+
'project_urls': {
|
359
|
+
'Documentation': 'https://docs.meerschaum.io',
|
360
|
+
'Changelog': 'https://meerschaum.io/news/changelog',
|
361
|
+
'GitHub': 'https://github.com/bmeares/Meerschaum',
|
362
|
+
'Homepage': 'https://meerschaum.io',
|
363
|
+
'Donate': 'https://github.com/sponsors/bmeares',
|
364
|
+
'Discord': 'https://discord.gg/8U8qMUjvcc',
|
365
|
+
},
|
366
|
+
'author': 'Bennett Meares',
|
367
|
+
'author_email': 'bennett.meares@gmail.com',
|
368
|
+
'maintainer_email': 'bennett.meares@gmail.com',
|
369
|
+
'license': 'Apache Software License 2.0',
|
370
|
+
'license_files': ('LICENSE',),
|
371
|
+
},
|
372
|
+
}
|
meerschaum/actions/api.py
CHANGED
@@ -96,6 +96,7 @@ def _api_start(
|
|
96
96
|
workers: Optional[int] = None,
|
97
97
|
mrsm_instance: Optional[str] = None,
|
98
98
|
no_dash: bool = False,
|
99
|
+
no_webterm: bool = False,
|
99
100
|
no_auth: bool = False,
|
100
101
|
private: bool = False,
|
101
102
|
secure: bool = False,
|
@@ -166,7 +167,7 @@ def _api_start(
|
|
166
167
|
)
|
167
168
|
from meerschaum.config._patch import apply_patch_to_config
|
168
169
|
from meerschaum.config._environment import get_env_vars
|
169
|
-
from meerschaum.
|
170
|
+
from meerschaum._internal.static import STATIC_CONFIG, SERVER_ID
|
170
171
|
from meerschaum.connectors.parse import parse_instance_keys
|
171
172
|
from meerschaum.utils.pool import get_pool
|
172
173
|
|
@@ -244,6 +245,7 @@ def _api_start(
|
|
244
245
|
'env_file': str(uvicorn_env_path.as_posix()),
|
245
246
|
'mrsm_instance': mrsm_instance,
|
246
247
|
'no_dash': no_dash,
|
248
|
+
'no_webterm': no_webterm or no_auth,
|
247
249
|
'no_auth': no_auth,
|
248
250
|
'private': private,
|
249
251
|
'production': production,
|
@@ -263,7 +265,15 @@ def _api_start(
|
|
263
265
|
if secure:
|
264
266
|
cf['system']['api']['permissions']['actions']['non_admin'] = False
|
265
267
|
|
266
|
-
custom_keys = [
|
268
|
+
custom_keys = [
|
269
|
+
'mrsm_instance',
|
270
|
+
'no_dash',
|
271
|
+
'no_webterm',
|
272
|
+
'no_auth',
|
273
|
+
'private',
|
274
|
+
'debug',
|
275
|
+
'production',
|
276
|
+
]
|
267
277
|
|
268
278
|
### write config to a temporary file to communicate with uvicorn threads
|
269
279
|
try:
|
meerschaum/actions/bootstrap.py
CHANGED
@@ -10,7 +10,7 @@ Functions for bootstrapping elements
|
|
10
10
|
from __future__ import annotations
|
11
11
|
|
12
12
|
import meerschaum as mrsm
|
13
|
-
from meerschaum.utils.typing import Union, Any,
|
13
|
+
from meerschaum.utils.typing import Union, Any, SuccessTuple, Optional, Tuple, List
|
14
14
|
|
15
15
|
|
16
16
|
def bootstrap(
|
@@ -249,7 +249,7 @@ def _bootstrap_connectors(
|
|
249
249
|
from meerschaum.config._edit import write_config
|
250
250
|
from meerschaum.utils.formatting import pprint
|
251
251
|
from meerschaum.utils.formatting._shell import clear_screen
|
252
|
-
from meerschaum.
|
252
|
+
from meerschaum.config._default import CONNECTOR_ATTRIBUTES
|
253
253
|
from meerschaum.utils.warnings import warn, info
|
254
254
|
from meerschaum.utils.misc import is_int
|
255
255
|
|
@@ -314,7 +314,7 @@ def _bootstrap_connectors(
|
|
314
314
|
cls_required_attrs = getattr(cls, 'REQUIRED_ATTRIBUTES', [])
|
315
315
|
cls_optional_attrs = getattr(cls, 'OPTIONAL_ATTRIBUTES', [])
|
316
316
|
cls_default_attrs = getattr(cls, 'DEFAULT_ATTRIBUTES', {})
|
317
|
-
type_attributes =
|
317
|
+
type_attributes = CONNECTOR_ATTRIBUTES.get(
|
318
318
|
_type,
|
319
319
|
{
|
320
320
|
'required': cls_required_attrs,
|
@@ -330,16 +330,16 @@ def _bootstrap_connectors(
|
|
330
330
|
f"Flavor for connector '{_type}:{_label}':",
|
331
331
|
sorted(list(type_attributes['flavors'])),
|
332
332
|
default = (
|
333
|
-
'
|
334
|
-
if '
|
333
|
+
'postgresql'
|
334
|
+
if 'postgresql' in type_attributes['flavors']
|
335
335
|
else None
|
336
336
|
)
|
337
337
|
)
|
338
338
|
except KeyboardInterrupt:
|
339
339
|
return abort_tuple
|
340
340
|
new_attributes['flavor'] = flavor
|
341
|
-
required = sorted(list(
|
342
|
-
optional = sorted(list(
|
341
|
+
required = sorted(list(CONNECTOR_ATTRIBUTES[_type]['flavors'][flavor]['requirements']))
|
342
|
+
optional = sorted(list(CONNECTOR_ATTRIBUTES[_type]['flavors'][flavor].get('optional', {})))
|
343
343
|
default = type_attributes['flavors'][flavor].get('defaults', {})
|
344
344
|
else:
|
345
345
|
required = sorted(list(type_attributes.get('required', {})))
|