meerschaum 2.0.0rc8__py3-none-any.whl → 2.0.0rc9__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/config/_default.py +1 -1
- meerschaum/config/_version.py +1 -1
- meerschaum/connectors/api/_fetch.py +40 -38
- meerschaum/connectors/api/_pipes.py +4 -6
- meerschaum/connectors/sql/_pipes.py +1 -2
- meerschaum/core/Pipe/__init__.py +31 -10
- meerschaum/core/Pipe/_data.py +23 -13
- meerschaum/core/Pipe/_deduplicate.py +6 -1
- meerschaum/core/Pipe/_fetch.py +29 -0
- meerschaum/core/Pipe/_sync.py +25 -18
- meerschaum/core/Pipe/_verify.py +1 -1
- meerschaum/utils/dataframe.py +2 -0
- meerschaum/utils/misc.py +1 -1
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/METADATA +1 -1
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/RECORD +21 -21
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/LICENSE +0 -0
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/NOTICE +0 -0
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/WHEEL +0 -0
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/entry_points.txt +0 -0
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/top_level.txt +0 -0
- {meerschaum-2.0.0rc8.dist-info → meerschaum-2.0.0rc9.dist-info}/zip-safe +0 -0
meerschaum/config/_default.py
CHANGED
@@ -112,12 +112,12 @@ default_pipes_config = {
|
|
112
112
|
'datetime': None,
|
113
113
|
'id': None,
|
114
114
|
},
|
115
|
-
'chunk_minutes': 1440,
|
116
115
|
'fetch': {
|
117
116
|
'backtrack_minutes': 1440,
|
118
117
|
},
|
119
118
|
'verify': {
|
120
119
|
'bound_days': 366,
|
120
|
+
'chunk_minutes': 1440,
|
121
121
|
},
|
122
122
|
},
|
123
123
|
'attributes': {
|
meerschaum/config/_version.py
CHANGED
@@ -7,60 +7,62 @@ Fetch Pipe data via the API connector
|
|
7
7
|
"""
|
8
8
|
|
9
9
|
from __future__ import annotations
|
10
|
-
import datetime
|
10
|
+
from datetime import datetime
|
11
11
|
import copy
|
12
|
-
|
12
|
+
import meerschaum as mrsm
|
13
|
+
from meerschaum.utils.typing import Any, Optional, Dict, Iterator, Union
|
13
14
|
|
14
15
|
def fetch(
|
15
16
|
self,
|
16
|
-
pipe:
|
17
|
-
begin:
|
18
|
-
end:
|
17
|
+
pipe: mrsm.Pipe,
|
18
|
+
begin: Union[datetime, str, int] = '',
|
19
|
+
end: Union[datetime, int] = None,
|
19
20
|
params: Optional[Dict, Any] = None,
|
20
21
|
debug: bool = False,
|
21
22
|
**kw: Any
|
22
|
-
) ->
|
23
|
+
) -> Iterator['pd.DataFrame']:
|
23
24
|
"""Get the Pipe data from the remote Pipe."""
|
24
25
|
from meerschaum.utils.debug import dprint
|
25
26
|
from meerschaum.utils.warnings import warn, error
|
26
|
-
from meerschaum.config.static import _static_config
|
27
27
|
from meerschaum.config._patch import apply_patch_to_config
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
fetch_params = pipe.parameters.get('fetch', {})
|
30
|
+
if not fetch_params:
|
31
|
+
warn(f"Missing 'fetch' parameters for {pipe}.", stack=False)
|
31
32
|
return None
|
32
33
|
|
33
|
-
|
34
|
+
pipe_meta = fetch_params.get('pipe', {})
|
35
|
+
### Legacy: check for `connector_keys`, etc. at the root.
|
36
|
+
if not pipe_meta:
|
37
|
+
ck, mk, lk = (
|
38
|
+
fetch_params.get('connector_keys', None),
|
39
|
+
fetch_params.get('metric_key', None),
|
40
|
+
fetch_params.get('location_key', None),
|
41
|
+
)
|
42
|
+
if not ck or not mk:
|
43
|
+
warn(f"Missing `fetch:pipe` keys for {pipe}.", stack=False)
|
44
|
+
return None
|
34
45
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
warn(f"Missing metric_key in fetch parameters for Pipe '{pipe}'", stack=False)
|
41
|
-
return None
|
42
|
-
remote_metric_key = instructions.get('metric_key', None)
|
43
|
-
remote_location_key = instructions.get('location_key', None)
|
44
|
-
if begin is None:
|
45
|
-
begin = pipe.get_sync_time(debug=debug)
|
46
|
+
pipe_meta.update({
|
47
|
+
'connector': ck,
|
48
|
+
'metric': mk,
|
49
|
+
'location': lk,
|
50
|
+
})
|
46
51
|
|
47
|
-
|
48
|
-
|
52
|
+
pipe_meta['instance'] = self
|
53
|
+
source_pipe = mrsm.Pipe(**pipe_meta)
|
49
54
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
remote_location_key,
|
55
|
-
mrsm_instance = self
|
56
|
-
)
|
57
|
-
begin = (
|
58
|
-
begin if not (isinstance(begin, str) and begin == '')
|
59
|
-
else pipe.get_sync_time(debug=debug)
|
60
|
-
)
|
55
|
+
_params = copy.deepcopy(params) if params is not None else {}
|
56
|
+
_params = apply_patch_to_config(_params, fetch_params.get('params', {}))
|
57
|
+
select_columns = fetch_params.get('select_columns', [])
|
58
|
+
omit_columns = fetch_params.get('omit_columns', [])
|
61
59
|
|
62
|
-
return
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
return source_pipe.get_data(
|
61
|
+
select_columns = select_columns,
|
62
|
+
omit_columns = omit_columns,
|
63
|
+
begin = begin,
|
64
|
+
end = end,
|
65
|
+
params = _params,
|
66
|
+
debug = debug,
|
67
|
+
as_iterator = True,
|
66
68
|
)
|
@@ -164,9 +164,7 @@ def sync_pipe(
|
|
164
164
|
debug: bool = False,
|
165
165
|
**kw: Any
|
166
166
|
) -> SuccessTuple:
|
167
|
-
"""
|
168
|
-
If Pipe does not exist, it is registered with supplied metadata.
|
169
|
-
"""
|
167
|
+
"""Sync a DataFrame into a Pipe."""
|
170
168
|
from meerschaum.utils.debug import dprint
|
171
169
|
from meerschaum.utils.misc import json_serialize_datetime
|
172
170
|
from meerschaum.config import get_config
|
@@ -186,14 +184,14 @@ def sync_pipe(
|
|
186
184
|
|
187
185
|
df = json.loads(df) if isinstance(df, str) else df
|
188
186
|
|
189
|
-
|
190
|
-
_chunksize : Optional[int] = (1 if chunksize is None else (
|
187
|
+
_chunksize: Optional[int] = (1 if chunksize is None else (
|
191
188
|
get_config('system', 'connectors', 'sql', 'chunksize') if chunksize == -1
|
192
189
|
else chunksize
|
193
190
|
))
|
194
|
-
keys
|
191
|
+
keys: list = list(df.keys())
|
195
192
|
chunks = []
|
196
193
|
if hasattr(df, 'index'):
|
194
|
+
df = df.reset_index(drop=True)
|
197
195
|
rowcount = len(df)
|
198
196
|
chunks = [df.iloc[i] for i in more_itertools.chunked(df.index, _chunksize)]
|
199
197
|
elif isinstance(df, dict):
|
@@ -1438,12 +1438,11 @@ def sync_pipe_inplace(
|
|
1438
1438
|
drop_backtrack_query = f"DROP TABLE {backtrack_table_name}"
|
1439
1439
|
if table_exists(backtrack_table_raw, self, debug=debug):
|
1440
1440
|
backtrack_queries.append(drop_backtrack_query)
|
1441
|
-
btm = max(self.get_pipe_backtrack_minutes(pipe), 1)
|
1442
1441
|
backtrack_def = self.get_pipe_data_query(
|
1443
1442
|
pipe,
|
1444
1443
|
begin = begin,
|
1445
1444
|
end = end,
|
1446
|
-
begin_add_minutes =
|
1445
|
+
begin_add_minutes = 0,
|
1447
1446
|
end_add_minutes = 1,
|
1448
1447
|
params = params,
|
1449
1448
|
debug = debug,
|
meerschaum/core/Pipe/__init__.py
CHANGED
@@ -81,7 +81,10 @@ class Pipe:
|
|
81
81
|
```
|
82
82
|
"""
|
83
83
|
|
84
|
-
from ._fetch import
|
84
|
+
from ._fetch import (
|
85
|
+
fetch,
|
86
|
+
get_backtrack_interval,
|
87
|
+
)
|
85
88
|
from ._data import (
|
86
89
|
get_data,
|
87
90
|
get_backtrack_data,
|
@@ -279,15 +282,26 @@ class Pipe:
|
|
279
282
|
|
280
283
|
@property
|
281
284
|
def meta(self):
|
282
|
-
"""
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
285
|
+
"""
|
286
|
+
Return the four keys needed to reconstruct this pipe.
|
287
|
+
"""
|
288
|
+
return {
|
289
|
+
'connector_keys': self.connector_keys,
|
290
|
+
'metric_key' : self.metric_key,
|
291
|
+
'location_key' : self.location_key,
|
292
|
+
'instance' : self.instance_keys,
|
293
|
+
}
|
294
|
+
|
295
|
+
|
296
|
+
def keys(self) -> List[str]:
|
297
|
+
"""
|
298
|
+
Return the ordered keys for this pipe.
|
299
|
+
"""
|
300
|
+
return {
|
301
|
+
key: val
|
302
|
+
for key, val in self.meta.items()
|
303
|
+
if key != 'instance'
|
304
|
+
}
|
291
305
|
|
292
306
|
|
293
307
|
@property
|
@@ -436,3 +450,10 @@ class Pipe:
|
|
436
450
|
metric_key = _state.pop('metric_key')
|
437
451
|
location_key = _state.pop('location_key')
|
438
452
|
self.__init__(connector_keys, metric_key, location_key, **_state)
|
453
|
+
|
454
|
+
|
455
|
+
def __getitem__(self, *args, **kwargs) -> Any:
|
456
|
+
"""
|
457
|
+
Index the pipe's attributes.
|
458
|
+
"""
|
459
|
+
return self.attributes.__getitem__(*args, **kwargs)
|
meerschaum/core/Pipe/_data.py
CHANGED
@@ -325,7 +325,7 @@ def _get_data_as_iterator(
|
|
325
325
|
def get_backtrack_data(
|
326
326
|
self,
|
327
327
|
backtrack_minutes: int = 0,
|
328
|
-
begin:
|
328
|
+
begin: Union[datetime, int, None] = None,
|
329
329
|
params: Optional[Dict[str, Any]] = None,
|
330
330
|
fresh: bool = False,
|
331
331
|
debug: bool = False,
|
@@ -338,7 +338,7 @@ def get_backtrack_data(
|
|
338
338
|
----------
|
339
339
|
backtrack_minutes: int, default 0
|
340
340
|
How many minutes from `begin` to select from.
|
341
|
-
|
341
|
+
If 0 (default), use `pipe.parameters['fetch']['backtrack_minutes']`.
|
342
342
|
|
343
343
|
begin: Optional[datetime], default None
|
344
344
|
The starting point to search for data.
|
@@ -370,7 +370,6 @@ def get_backtrack_data(
|
|
370
370
|
-------
|
371
371
|
A `pd.DataFrame` for the pipe's data corresponding to the provided parameters. Backtrack data
|
372
372
|
is a convenient way to get a pipe's data "backtracked" from the most recent datetime.
|
373
|
-
|
374
373
|
"""
|
375
374
|
from meerschaum.utils.warnings import warn
|
376
375
|
from meerschaum.utils.venv import Venv
|
@@ -379,6 +378,14 @@ def get_backtrack_data(
|
|
379
378
|
if not self.exists(debug=debug):
|
380
379
|
return None
|
381
380
|
|
381
|
+
backtrack_interval = self.get_backtrack_interval(debug=debug)
|
382
|
+
if backtrack_minutes == 0:
|
383
|
+
backtrack_minutes = (
|
384
|
+
(backtrack_interval.total_seconds() * 60)
|
385
|
+
if isinstance(backtrack_interval, timedelta)
|
386
|
+
else backtrack_interval
|
387
|
+
)
|
388
|
+
|
382
389
|
if self.cache_pipe is not None:
|
383
390
|
if not fresh:
|
384
391
|
_sync_cache_tuple = self.cache_pipe.sync(begin=begin, params=params, debug=debug, **kw)
|
@@ -438,7 +445,7 @@ def get_rowcount(
|
|
438
445
|
params: Optional[Dict[str, Any]] = None,
|
439
446
|
remote: bool = False,
|
440
447
|
debug: bool = False
|
441
|
-
) ->
|
448
|
+
) -> int:
|
442
449
|
"""
|
443
450
|
Get a Pipe's instance or remote rowcount.
|
444
451
|
|
@@ -460,8 +467,7 @@ def get_rowcount(
|
|
460
467
|
Returns
|
461
468
|
-------
|
462
469
|
An `int` of the number of rows in the pipe corresponding to the provided parameters.
|
463
|
-
|
464
|
-
|
470
|
+
Returned 0 if the pipe does not exist.
|
465
471
|
"""
|
466
472
|
from meerschaum.utils.warnings import warn
|
467
473
|
from meerschaum.utils.venv import Venv
|
@@ -470,7 +476,7 @@ def get_rowcount(
|
|
470
476
|
connector = self.instance_connector if not remote else self.connector
|
471
477
|
try:
|
472
478
|
with Venv(get_connector_plugin(connector)):
|
473
|
-
|
479
|
+
rowcount = connector.get_pipe_rowcount(
|
474
480
|
self,
|
475
481
|
begin = begin,
|
476
482
|
end = end,
|
@@ -478,12 +484,15 @@ def get_rowcount(
|
|
478
484
|
remote = remote,
|
479
485
|
debug = debug,
|
480
486
|
)
|
487
|
+
if rowcount is None:
|
488
|
+
return 0
|
489
|
+
return rowcount
|
481
490
|
except AttributeError as e:
|
482
491
|
warn(e)
|
483
492
|
if remote:
|
484
|
-
return
|
493
|
+
return 0
|
485
494
|
warn(f"Failed to get a rowcount for {self}.")
|
486
|
-
return
|
495
|
+
return 0
|
487
496
|
|
488
497
|
|
489
498
|
def get_chunk_interval(
|
@@ -505,8 +514,8 @@ def get_chunk_interval(
|
|
505
514
|
-------
|
506
515
|
The chunk interval (`timedelta` or `int`) to use with this pipe's `datetime` axis.
|
507
516
|
"""
|
508
|
-
default_chunk_minutes = get_config('pipes', 'parameters', 'chunk_minutes')
|
509
|
-
configured_chunk_minutes = self.parameters.get('chunk_minutes', None)
|
517
|
+
default_chunk_minutes = get_config('pipes', 'parameters', 'verify', 'chunk_minutes')
|
518
|
+
configured_chunk_minutes = self.parameters.get('verify', {}).get('chunk_minutes', None)
|
510
519
|
chunk_minutes = (
|
511
520
|
(configured_chunk_minutes or default_chunk_minutes)
|
512
521
|
if chunk_interval is None
|
@@ -559,7 +568,8 @@ def get_chunk_bounds(
|
|
559
568
|
|
560
569
|
chunk_interval: Union[timedelta, int, None], default None
|
561
570
|
If provided, use this interval for the size of chunk boundaries.
|
562
|
-
The default value for this pipe may be set
|
571
|
+
The default value for this pipe may be set
|
572
|
+
under `pipe.parameters['verify']['chunk_minutes']`.
|
563
573
|
|
564
574
|
debug: bool, default False
|
565
575
|
Verbosity toggle.
|
@@ -578,7 +588,7 @@ def get_chunk_bounds(
|
|
578
588
|
if begin is None and end is None:
|
579
589
|
return [(None, None)]
|
580
590
|
|
581
|
-
### Set the chunk interval under `pipe.parameters['chunk_minutes']`.
|
591
|
+
### Set the chunk interval under `pipe.parameters['verify']['chunk_minutes']`.
|
582
592
|
chunk_interval = self.get_chunk_interval(chunk_interval, debug=debug)
|
583
593
|
|
584
594
|
### Build a list of tuples containing the chunk boundaries
|
@@ -173,7 +173,12 @@ def deduplicate(
|
|
173
173
|
if not chunk_indices:
|
174
174
|
return bounds, (False, f"None of {items_str(indices)} were present in chunk.")
|
175
175
|
try:
|
176
|
-
full_chunk = full_chunk.drop_duplicates(
|
176
|
+
full_chunk = full_chunk.drop_duplicates(
|
177
|
+
subset = chunk_indices,
|
178
|
+
keep = 'last'
|
179
|
+
).reset_index(
|
180
|
+
drop = True,
|
181
|
+
)
|
177
182
|
except Exception as e:
|
178
183
|
return (
|
179
184
|
bounds,
|
meerschaum/core/Pipe/_fetch.py
CHANGED
@@ -7,7 +7,9 @@ Functions for fetching new data into the Pipe
|
|
7
7
|
"""
|
8
8
|
|
9
9
|
from __future__ import annotations
|
10
|
+
from datetime import timedelta
|
10
11
|
from meerschaum.utils.typing import Optional, Any
|
12
|
+
from meerschaum.config import get_config
|
11
13
|
|
12
14
|
def fetch(
|
13
15
|
self,
|
@@ -98,3 +100,30 @@ def fetch(
|
|
98
100
|
connector_plugin.deactivate_venv(debug=debug)
|
99
101
|
|
100
102
|
return df
|
103
|
+
|
104
|
+
|
105
|
+
def get_backtrack_interval(self, debug: bool = False) -> Union[timedelta, int]:
|
106
|
+
"""
|
107
|
+
Get the chunk interval to use for this pipe.
|
108
|
+
|
109
|
+
Returns
|
110
|
+
-------
|
111
|
+
The backtrack interval (`timedelta` or `int`) to use with this pipe's `datetime` axis.
|
112
|
+
"""
|
113
|
+
default_backtrack_minutes = get_config('pipes', 'parameters', 'fetch', 'backtrack_minutes')
|
114
|
+
configured_backtrack_minutes = self.parameters.get('fetch', {}).get('backtrack_minutes', None)
|
115
|
+
backtrack_minutes = (
|
116
|
+
configured_backtrack_minutes
|
117
|
+
if configured_backtrack_minutes is not None
|
118
|
+
else default_backtrack_minutes
|
119
|
+
)
|
120
|
+
|
121
|
+
dt_col = self.columns.get('datetime', None)
|
122
|
+
if dt_col is None:
|
123
|
+
return timedelta(minutes=backtrack_minutes)
|
124
|
+
|
125
|
+
dt_dtype = self.dtypes.get(dt_col, 'datetime64[ns]')
|
126
|
+
if 'datetime' in dt_dtype.lower():
|
127
|
+
return timedelta(minutes=backtrack_minutes)
|
128
|
+
|
129
|
+
return backtrack_minutes
|
meerschaum/core/Pipe/_sync.py
CHANGED
@@ -14,7 +14,16 @@ import threading
|
|
14
14
|
from datetime import datetime, timedelta
|
15
15
|
|
16
16
|
from meerschaum.utils.typing import (
|
17
|
-
Union,
|
17
|
+
Union,
|
18
|
+
Optional,
|
19
|
+
Callable,
|
20
|
+
Any,
|
21
|
+
Tuple,
|
22
|
+
SuccessTuple,
|
23
|
+
Dict,
|
24
|
+
List,
|
25
|
+
Iterable,
|
26
|
+
Generator,
|
18
27
|
Iterator,
|
19
28
|
)
|
20
29
|
|
@@ -29,8 +38,8 @@ def sync(
|
|
29
38
|
List[Dict[str, Any]],
|
30
39
|
InferFetch
|
31
40
|
] = InferFetch,
|
32
|
-
begin:
|
33
|
-
end:
|
41
|
+
begin: Union[datetime, int, str, None] = '',
|
42
|
+
end: Union[datetime, int] = None,
|
34
43
|
force: bool = False,
|
35
44
|
retries: int = 10,
|
36
45
|
min_seconds: int = 1,
|
@@ -55,28 +64,23 @@ def sync(
|
|
55
64
|
df: Union[None, pd.DataFrame, Dict[str, List[Any]]], default None
|
56
65
|
An optional DataFrame to sync into the pipe. Defaults to `None`.
|
57
66
|
|
58
|
-
begin:
|
67
|
+
begin: Union[datetime, int, str, None], default ''
|
59
68
|
Optionally specify the earliest datetime to search for data.
|
60
|
-
Defaults to `None`.
|
61
69
|
|
62
|
-
end:
|
70
|
+
end: Union[datetime, int, str, None], default None
|
63
71
|
Optionally specify the latest datetime to search for data.
|
64
|
-
Defaults to `None`.
|
65
72
|
|
66
73
|
force: bool, default False
|
67
74
|
If `True`, keep trying to sync untul `retries` attempts.
|
68
|
-
Defaults to `False`.
|
69
75
|
|
70
76
|
retries: int, default 10
|
71
77
|
If `force`, how many attempts to try syncing before declaring failure.
|
72
|
-
Defaults to `10`.
|
73
78
|
|
74
79
|
min_seconds: Union[int, float], default 1
|
75
80
|
If `force`, how many seconds to sleep between retries. Defaults to `1`.
|
76
81
|
|
77
82
|
check_existing: bool, default True
|
78
83
|
If `True`, pull and diff with existing data from the pipe.
|
79
|
-
Defaults to `True`.
|
80
84
|
|
81
85
|
blocking: bool, default True
|
82
86
|
If `True`, wait for sync to finish and return its result, otherwise
|
@@ -87,7 +91,6 @@ def sync(
|
|
87
91
|
If provided and the instance connector is thread-safe
|
88
92
|
(`pipe.instance_connector.IS_THREAD_SAFE is True`),
|
89
93
|
limit concurrent sync to this many threads.
|
90
|
-
Defaults to `None`.
|
91
94
|
|
92
95
|
callback: Optional[Callable[[Tuple[bool, str]], Any]], default None
|
93
96
|
Callback function which expects a SuccessTuple as input.
|
@@ -101,7 +104,6 @@ def sync(
|
|
101
104
|
Specify the number of rows to sync per chunk.
|
102
105
|
If `-1`, resort to system configuration (default is `900`).
|
103
106
|
A `chunksize` of `None` will sync all rows in one transaction.
|
104
|
-
Defaults to `-1`.
|
105
107
|
|
106
108
|
sync_chunks: bool, default True
|
107
109
|
If possible, sync chunks while fetching them into memory.
|
@@ -112,7 +114,6 @@ def sync(
|
|
112
114
|
Returns
|
113
115
|
-------
|
114
116
|
A `SuccessTuple` of success (`bool`) and message (`str`).
|
115
|
-
|
116
117
|
"""
|
117
118
|
from meerschaum.utils.debug import dprint, _checkpoint
|
118
119
|
from meerschaum.utils.warnings import warn, error
|
@@ -183,7 +184,7 @@ def sync(
|
|
183
184
|
### use that instead.
|
184
185
|
### NOTE: The DataFrame must be omitted for the plugin sync method to apply.
|
185
186
|
### If a DataFrame is provided, continue as expected.
|
186
|
-
if hasattr(df, 'MRSM_INFER_FETCH'):
|
187
|
+
if hasattr(df, 'MRSM_INFER_FETCH'):
|
187
188
|
try:
|
188
189
|
if p.connector is None:
|
189
190
|
msg = f"{p} does not have a valid connector."
|
@@ -430,13 +431,19 @@ def sync(
|
|
430
431
|
|
431
432
|
def _determine_begin(
|
432
433
|
pipe: meerschaum.Pipe,
|
433
|
-
begin:
|
434
|
+
begin: Union[datetime, int, str] = '',
|
434
435
|
debug: bool = False,
|
435
436
|
) -> Union[datetime, int, None]:
|
436
|
-
|
437
|
-
if begin is not
|
437
|
+
"""
|
438
|
+
Apply the backtrack interval if `--begin` is not provided.
|
439
|
+
"""
|
440
|
+
if begin != '':
|
438
441
|
return begin
|
439
|
-
|
442
|
+
sync_time = pipe.get_sync_time(debug=debug)
|
443
|
+
if sync_time is None:
|
444
|
+
return sync_time
|
445
|
+
backtrack_interval = pipe.get_backtrack_interval(debug=debug)
|
446
|
+
return sync_time - backtrack_interval
|
440
447
|
|
441
448
|
|
442
449
|
def get_sync_time(
|
meerschaum/core/Pipe/_verify.py
CHANGED
@@ -211,7 +211,7 @@ def verify(
|
|
211
211
|
bounds_success_tuples.update(dict(pool.map(process_chunk_bounds, chunk_bounds)))
|
212
212
|
bounds_success_bools = {bounds: tup[0] for bounds, tup in bounds_success_tuples.items()}
|
213
213
|
|
214
|
-
message_header = f"{
|
214
|
+
message_header = f"{begin_to_print} - {end_to_print}"
|
215
215
|
if all(bounds_success_bools.values()):
|
216
216
|
msg = get_chunks_success_message(bounds_success_tuples, header=message_header)
|
217
217
|
if deduplicate:
|
meerschaum/utils/dataframe.py
CHANGED
meerschaum/utils/misc.py
CHANGED
@@ -120,7 +120,7 @@ meerschaum/api/routes/_version.py,sha256=2t-nw_9IxCVZCNEar0LOwmut2zsClRVHjiOOUx1
|
|
120
120
|
meerschaum/api/routes/_webterm.py,sha256=LhYySOwk3YkfoK7PEB8KAW-XjQuu8vkKtsvx2F6zAGE,4473
|
121
121
|
meerschaum/api/tables/__init__.py,sha256=yDPiUA01EEc_YgkjKT7jAl93xGPNpVRAh8EYIhVuInY,615
|
122
122
|
meerschaum/config/__init__.py,sha256=MrsDaLvF98biffvuEEfAzrHPzyA9HtfF_8whKtcLkak,11569
|
123
|
-
meerschaum/config/_default.py,sha256=
|
123
|
+
meerschaum/config/_default.py,sha256=kbmqpNAIi8D97G929J_iWkdJtF0tv6tGkGhcbxYM-ls,5010
|
124
124
|
meerschaum/config/_edit.py,sha256=z7gBr5YGYkUbwkUsZwd9xncmxttkdxcS9cVbgLo2zCA,8679
|
125
125
|
meerschaum/config/_environment.py,sha256=PNo0rgiUnp0XnplC1ID-d97AKw4gc0Cc4g-jr126gwg,4507
|
126
126
|
meerschaum/config/_formatting.py,sha256=PiiNDra60xLEPSuOQ4ypSmlpCnA4m9t_gzEyXePpoMM,6450
|
@@ -131,7 +131,7 @@ meerschaum/config/_preprocess.py,sha256=-AEA8m_--KivZwTQ1sWN6LTn5sio_fUr2XZ51BO6
|
|
131
131
|
meerschaum/config/_read_config.py,sha256=d2oBR-5vKHuRmOaaRqxK-HPJNAuieR2DS8S0u1tqorg,14532
|
132
132
|
meerschaum/config/_shell.py,sha256=k6PH0BEr2imhgURLYlR5p6s5gXfYpWoyZSV29U-SsXk,3589
|
133
133
|
meerschaum/config/_sync.py,sha256=Q-sz5YcjL3CJS2Dyw4rVRQsz9th9GWa9o5F9D0Jrmn8,4120
|
134
|
-
meerschaum/config/_version.py,sha256=
|
134
|
+
meerschaum/config/_version.py,sha256=bqB4XsE7Fnbu_aowwVoC5BCZR-xFXEB4Mpzo_V96pfg,74
|
135
135
|
meerschaum/config/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
136
136
|
meerschaum/config/stack/__init__.py,sha256=4a_up1oxkitwgIylWWk0vA4XkGhEpWazUaENOPEdYQI,9034
|
137
137
|
meerschaum/config/stack/grafana/__init__.py,sha256=wzuoch_AK49lcn7lH2qTSJ_PPbSagF4lcweeipz_XiE,2010
|
@@ -147,12 +147,12 @@ meerschaum/connectors/api/APIConnector.py,sha256=JmAg7TU0akEiDMXuoGdFLL5jRhV4whl
|
|
147
147
|
meerschaum/connectors/api/__init__.py,sha256=JwKrGtuE5aOd2VnsRwudFBYyBf5IxczOwPVdNvCUgSQ,205
|
148
148
|
meerschaum/connectors/api/_actions.py,sha256=YtfW6GlHct_azF8DjvXpAgNpnQnVF9kYITcfz7C0g9Q,2755
|
149
149
|
meerschaum/connectors/api/_delete.py,sha256=2OXR6I-SWIH4uwK4D0x3_dCVZltRPb-9mqlZCU9Jor0,945
|
150
|
-
meerschaum/connectors/api/_fetch.py,sha256=
|
150
|
+
meerschaum/connectors/api/_fetch.py,sha256=Khq9AFr1nk8Dsmcedb77aWhAuHw0JGgVeahDG95Q5MQ,2072
|
151
151
|
meerschaum/connectors/api/_get.py,sha256=6O-2YzKeeYYkV5GO4vE2Zek5MVcOW_KLkI10WNvEbwo,1572
|
152
152
|
meerschaum/connectors/api/_login.py,sha256=5GsD-B214vr5EYfM3XrTUs1sTFApxZA-9dNxq8oNSyg,2050
|
153
153
|
meerschaum/connectors/api/_misc.py,sha256=SIAiob8LjlCsvodKbAhYdrk_7HAKAv-lWkCHBoj30qI,1093
|
154
154
|
meerschaum/connectors/api/_patch.py,sha256=2i4X7E3ZUQXEqwwP3YUC9ik37HSS1NLKcN1k76kKPO0,933
|
155
|
-
meerschaum/connectors/api/_pipes.py,sha256=
|
155
|
+
meerschaum/connectors/api/_pipes.py,sha256=3JZLHDPqgSCn79eUcEBZEkZpwRlCXWfN0lYyfsXH4jM,20940
|
156
156
|
meerschaum/connectors/api/_plugins.py,sha256=0qGXF_dFFHoetxM4aP9FHzyUVx7SWgvYgbCoFk7gQgk,5163
|
157
157
|
meerschaum/connectors/api/_post.py,sha256=uB6IS2HhStM70ZbeEwmpC0ysHGfJcuP4Q5DEWkq1ngU,922
|
158
158
|
meerschaum/connectors/api/_uri.py,sha256=h4Gj63f0q2V-TNMd8aAkQZMIj_-pA6uGacg_RNEJILI,1489
|
@@ -164,7 +164,7 @@ meerschaum/connectors/sql/__init__.py,sha256=xwSYhYuketTXhQLXyD9pZ0NNBPboW5Oqv9z
|
|
164
164
|
meerschaum/connectors/sql/_cli.py,sha256=hqiVSJ6o6D6NvrZreIqi1bv82btuN5slmyylv_AYppk,3495
|
165
165
|
meerschaum/connectors/sql/_create_engine.py,sha256=kxbNUVzKwgCf3Sd03qZRIC5GYD7EFLL72oeEh1ArZdc,10446
|
166
166
|
meerschaum/connectors/sql/_fetch.py,sha256=UH9yLzucF24X6f6hqwXskkJP5Flkg6WznHB47Lo8uz4,12956
|
167
|
-
meerschaum/connectors/sql/_pipes.py,sha256=
|
167
|
+
meerschaum/connectors/sql/_pipes.py,sha256=2SOX7QuZEsJ49svXo9kXAP8AIf7zNg5pII7zezDGEOY,93224
|
168
168
|
meerschaum/connectors/sql/_plugins.py,sha256=hS0cuJQxwd6jUfY136AQ33dGQw_MigP_OFC84KdSMhA,8323
|
169
169
|
meerschaum/connectors/sql/_sql.py,sha256=65cEghqq56sZdSA2mVt6rTz9AEAVzkcz77vyi_9MUEw,31069
|
170
170
|
meerschaum/connectors/sql/_uri.py,sha256=qCdCpw6IEVfLGw3E008ChlpdUYwpmadrM79MkGKwqtw,3312
|
@@ -173,32 +173,32 @@ meerschaum/connectors/sql/tools.py,sha256=jz8huOaRCwGlYdtGfAqAh7SoK8uydYBrasKQba
|
|
173
173
|
meerschaum/connectors/sql/tables/__init__.py,sha256=ZfwNDXI5ZeBr33mBq8-XDHv4-RaoituBmIhEnItvscA,6489
|
174
174
|
meerschaum/connectors/sql/tables/types.py,sha256=Jc_MTHIBM-KHpQt__Lckp39CeOo7tGOiAk5faDx-znY,1573
|
175
175
|
meerschaum/core/__init__.py,sha256=tjASW10n9uLV6bYhcwP4rggh-ESXSJzgxpSBbVsuISs,251
|
176
|
-
meerschaum/core/Pipe/__init__.py,sha256=
|
176
|
+
meerschaum/core/Pipe/__init__.py,sha256=mah4yr1435GfNDmFJ4zDOZZPIt1HPPanJ1Z1RBW_veQ,15468
|
177
177
|
meerschaum/core/Pipe/_attributes.py,sha256=XbSHfDsomaNymzf7-__UhbHqu6mlTTx20xprsw_L04I,13202
|
178
178
|
meerschaum/core/Pipe/_bootstrap.py,sha256=sTbHUX8V0Kfn6vEErXzsVslSjQNfQ5MxXxxuRYslr4w,7613
|
179
179
|
meerschaum/core/Pipe/_clear.py,sha256=hQVPztHiadzLB0c4_yFg6EETnf9MtFdJDCpO41Giuco,2261
|
180
|
-
meerschaum/core/Pipe/_data.py,sha256=
|
181
|
-
meerschaum/core/Pipe/_deduplicate.py,sha256=
|
180
|
+
meerschaum/core/Pipe/_data.py,sha256=GegtQn8JDD1E-jjAB1YZlEeGS2s1Y_f-7FP96wznzjA,20566
|
181
|
+
meerschaum/core/Pipe/_deduplicate.py,sha256=M1Qdpy48T0vaHuuwQLtjBnQ4KmHOtzkoVuQiZzDZE2Q,10246
|
182
182
|
meerschaum/core/Pipe/_delete.py,sha256=_VDacjB4lWlsOSqwDVZ56qxR_AcWE7bUuqXLR27uEhs,1854
|
183
183
|
meerschaum/core/Pipe/_drop.py,sha256=uf3MvMkCw9tVfJ2fuo8LqZ4vvMNa3xC3YoFGEuc-hH8,1052
|
184
184
|
meerschaum/core/Pipe/_dtypes.py,sha256=e8CbAx9fSN79OwV2OgvesbG5TG49O7Mrb5ScTKDCjSU,3636
|
185
185
|
meerschaum/core/Pipe/_edit.py,sha256=ZH2A0ZOpZKsVDnQxKzmXspNQKTEFUhkkZDjwOkmWtaY,8471
|
186
|
-
meerschaum/core/Pipe/_fetch.py,sha256=
|
186
|
+
meerschaum/core/Pipe/_fetch.py,sha256=3wjNV82X6ueuojtAHosRnIW1Le_Q_czHJB0bwxZUV00,4175
|
187
187
|
meerschaum/core/Pipe/_register.py,sha256=Sd5xaAW8H7uLTIoommcKb-6kHPRuHJLWNSbPnt2UbvA,2240
|
188
188
|
meerschaum/core/Pipe/_show.py,sha256=nG50y8eBT9TVuKkRgAKtNDNIxysJvMNxfu__lkL1F9k,1352
|
189
|
-
meerschaum/core/Pipe/_sync.py,sha256=
|
190
|
-
meerschaum/core/Pipe/_verify.py,sha256=
|
189
|
+
meerschaum/core/Pipe/_sync.py,sha256=TUoibfbf0c-GiWzYSURNKoDVNTAwXvdYtR0SLCztS1o,27333
|
190
|
+
meerschaum/core/Pipe/_verify.py,sha256=uVwXGlZ5vmlDDdKIHmBC22iE4SM-SfIcHNBkkheklTU,13828
|
191
191
|
meerschaum/core/Plugin/__init__.py,sha256=UXg64EvJPgI1PCxkY_KM02-ZmBm4FZpLPIQR_uSJJDc,137
|
192
192
|
meerschaum/core/User/_User.py,sha256=waVdpH4SFZSXNYBgX5KFQ8csbCSxRLI5T2efAzVONks,2448
|
193
193
|
meerschaum/core/User/__init__.py,sha256=EiL0rYdtNeu2HqXFLurJcyomjyw3UTFdAR8rgb_vlbU,161
|
194
194
|
meerschaum/plugins/_Plugin.py,sha256=Vzu5I01sjM9r_pbI13qYZXw2BxByi0ZPbWXy2O0rdgk,33813
|
195
195
|
meerschaum/plugins/__init__.py,sha256=uuNlHp9d4NE8I5NNDoTmzDLNyYKr98DVeCntXU0OzMQ,18533
|
196
196
|
meerschaum/utils/__init__.py,sha256=51AehMXFxtugn3a0RkNyJnlFTLBI4kxSQizRMx6p-rI,444
|
197
|
-
meerschaum/utils/dataframe.py,sha256=
|
197
|
+
meerschaum/utils/dataframe.py,sha256=fkbVRGu5QFS-A79rbAMOCqWsXeZmbKEjHztxa4TTabg,22576
|
198
198
|
meerschaum/utils/debug.py,sha256=ry9UWf0ECelVIuBApwmKxPZ_IoL6UqjTSMpGNbjghVQ,3690
|
199
199
|
meerschaum/utils/get_pipes.py,sha256=oJ87VzX6m9--9hN_x33mfaOX7AjMypAAA7ODI2pBfEI,11791
|
200
200
|
meerschaum/utils/interactive.py,sha256=nIILo5eh8NC6qkYD-ycWOS9r3yV5i1cJuhXhHX8sHMU,3419
|
201
|
-
meerschaum/utils/misc.py,sha256=
|
201
|
+
meerschaum/utils/misc.py,sha256=WyRHq_V6pX6EnuNrPvG4KddMpSfxvEVi4ieHBenx1Fw,42406
|
202
202
|
meerschaum/utils/networking.py,sha256=Sr_eYUGW8_UV9-k9LqRFf7xLtbUcsDucODyLCRsFRUc,1006
|
203
203
|
meerschaum/utils/pool.py,sha256=svLZL3N9vaDY8fz8lwm_3QtEVHWrFDxDUKpeJNOqY4I,2781
|
204
204
|
meerschaum/utils/process.py,sha256=tbEutHAg_Kn5UetOI-fduRjsafGOYX5tkLvpzqosgvc,7098
|
@@ -226,11 +226,11 @@ meerschaum/utils/packages/_packages.py,sha256=c3rjxENX02kyAwUzSYvLoGFJNrYvxaLlFy
|
|
226
226
|
meerschaum/utils/packages/lazy_loader.py,sha256=VHnph3VozH29R4JnSSBfwtA5WKZYZQFT_GeQSShCnuc,2540
|
227
227
|
meerschaum/utils/venv/_Venv.py,sha256=sBnlmxHdAh2bx8btfVoD79-H9-cYsv5lP02IIXkyECs,3553
|
228
228
|
meerschaum/utils/venv/__init__.py,sha256=kPgXtjJkqhl5pbpOoVS6uXh8BRzViHjPqqHnT0r_eRY,22288
|
229
|
-
meerschaum-2.0.
|
230
|
-
meerschaum-2.0.
|
231
|
-
meerschaum-2.0.
|
232
|
-
meerschaum-2.0.
|
233
|
-
meerschaum-2.0.
|
234
|
-
meerschaum-2.0.
|
235
|
-
meerschaum-2.0.
|
236
|
-
meerschaum-2.0.
|
229
|
+
meerschaum-2.0.0rc9.dist-info/LICENSE,sha256=jG2zQEdRNt88EgHUWPpXVWmOrOduUQRx7MnYV9YIPaw,11359
|
230
|
+
meerschaum-2.0.0rc9.dist-info/METADATA,sha256=hRbRZAWUszZY-tuSVX90J2bqLdjtEVEb8Ksf09Y0LLc,25174
|
231
|
+
meerschaum-2.0.0rc9.dist-info/NOTICE,sha256=OTA9Fcthjf5BRvWDDIcBC_xfLpeDV-RPZh3M-HQBRtQ,114
|
232
|
+
meerschaum-2.0.0rc9.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
233
|
+
meerschaum-2.0.0rc9.dist-info/entry_points.txt,sha256=5YBVzibw-0rNA_1VjB16z5GABsOGf-CDhW4yqH8C7Gc,88
|
234
|
+
meerschaum-2.0.0rc9.dist-info/top_level.txt,sha256=bNoSiDj0El6buocix-FRoAtJOeq1qOF5rRm2u9i7Q6A,11
|
235
|
+
meerschaum-2.0.0rc9.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
236
|
+
meerschaum-2.0.0rc9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|