ping-dataexport 0.4.0__tar.gz → 0.4.1__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.
- {ping_dataexport-0.4.0/src/ping_dataexport.egg-info → ping_dataexport-0.4.1}/PKG-INFO +38 -5
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/README.md +37 -4
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/job.sample.ini +13 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/pyproject.toml +1 -1
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/__init__.py +1 -1
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/job/spec.py +38 -7
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1/src/ping_dataexport.egg-info}/PKG-INFO +38 -5
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/LICENSE +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/MANIFEST.in +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/config.sample.ini +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/setup.cfg +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/__config__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/__main__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/api.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/cli.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/config.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/__init__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/connector.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/mysql_connector.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/oracle_connector.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/paramstyle.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/postgres_connector.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/pyodbc_connector.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/sqlite_connector.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/type_map.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/errors.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/export/__init__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/export/engine.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/export/options.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/export/runner.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/export/util.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/job/__init__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/job/executor.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/job/shared_context.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/job/validator.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/logger/__init__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/logger/applogger.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/logger/logpath.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/paths.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/planner/__init__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/planner/base.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/planner/datelist.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/planner/groupby.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/planner/monthbydate.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/planner/single.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/planner/watermark.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/writer/__init__.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/writer/arrow_map.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/writer/base.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/writer/delimited.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/writer/parquet.py +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport.egg-info/SOURCES.txt +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport.egg-info/dependency_links.txt +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport.egg-info/entry_points.txt +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport.egg-info/requires.txt +0 -0
- {ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ping-dataexport
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: PING's Data Export Tool - To Parquet/CSV/TEXT as Accelerator for Data & AI Project
|
|
5
5
|
Author: Vorapol Ping (ping-godhand)
|
|
6
6
|
Maintainer: Godhand.DEV
|
|
@@ -396,8 +396,8 @@ All options:
|
|
|
396
396
|
| `-m` | `--mode` | export mode: `groupby` \| `date` \| `relativedate` \| `monthbydate` \| `splitrow` \| `watermark` — see section 3 |
|
|
397
397
|
| `-col` | `--column` | column the mode partitions on |
|
|
398
398
|
| `-row` | `--row` | rows per file (`-m splitrow`) |
|
|
399
|
-
| `-df` | `--datefrom` | start / anchor date `yyyy-MM-dd
|
|
400
|
-
| `-dt` | `--dateto` | end date `yyyy-MM-dd` (`-m date`) |
|
|
399
|
+
| `-df` | `--datefrom` | start / anchor date `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (see *Date tokens*); omitted with `-dr`/`-mr` ⇒ today (system date) |
|
|
400
|
+
| `-dt` | `--dateto` | end date `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (`-m date`) |
|
|
401
401
|
| `-dr` | `--daysrelative` | days back from `-df` (`-m relativedate`) |
|
|
402
402
|
| `-mr` | `--monthsrelative` | months back from `-df` (`-m monthbydate`) |
|
|
403
403
|
| `-rm` | `--removeexisting` | `Yes`: clear the output directory before exporting |
|
|
@@ -430,6 +430,39 @@ All options:
|
|
|
430
430
|
Modes split one query into multiple files. All need `-dir` (output directory)
|
|
431
431
|
+ `-pf` (filename prefix); partition values are always bound SQL parameters.
|
|
432
432
|
|
|
433
|
+
### Date tokens for `-df` / `-dt` (`DateFrom` / `DateTo`)
|
|
434
|
+
|
|
435
|
+
Instead of a fixed `yyyy-MM-dd`, both accept the current date of the machine
|
|
436
|
+
running the export, optionally shifted by whole days:
|
|
437
|
+
|
|
438
|
+
| Token | Meaning |
|
|
439
|
+
|-------|---------|
|
|
440
|
+
| `@@CURRENT_DATE@@` | today |
|
|
441
|
+
| `@@CURRENT_DATE@@-N@@` | today minus N days, e.g. `@@CURRENT_DATE@@-7@@` |
|
|
442
|
+
| `@@CURRENT_DATE@@+N@@` | today plus N days, e.g. `@@CURRENT_DATE@@+1@@` |
|
|
443
|
+
|
|
444
|
+
`N` is a plain integer (`-1`, `-30`, `-100`, `+10` …). The token is
|
|
445
|
+
case-insensitive. Anything else — a missing closing `@@`, a non-integer, a
|
|
446
|
+
space, a double sign — is rejected with a validation error before anything runs.
|
|
447
|
+
Handy in job files that run daily:
|
|
448
|
+
|
|
449
|
+
```ini
|
|
450
|
+
[Last7Days]
|
|
451
|
+
Source=DB01
|
|
452
|
+
Query=SELECT * FROM sales
|
|
453
|
+
Mode=date
|
|
454
|
+
Column=txn_date
|
|
455
|
+
DateFrom=@@CURRENT_DATE@@-7@@
|
|
456
|
+
DateTo=@@CURRENT_DATE@@-1@@
|
|
457
|
+
OutputDir=out/last7
|
|
458
|
+
BaseName=sales
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
ping-dataexport -s DB01 -q "SELECT * FROM sales" -m date -col txn_date \
|
|
463
|
+
-df "@@CURRENT_DATE@@-7@@" -dt "@@CURRENT_DATE@@" -dir last7 -pf sales
|
|
464
|
+
```
|
|
465
|
+
|
|
433
466
|
**`groupby` — one file per distinct value of a column:**
|
|
434
467
|
|
|
435
468
|
```bash
|
|
@@ -576,8 +609,8 @@ Every job.ini key and the CLI option it mirrors (keys are case-insensitive):
|
|
|
576
609
|
| `Mode` | `-m` / `--mode` | `groupby` / `date` / `relativedate` / `monthbydate` / `splitrow` / `watermark` |
|
|
577
610
|
| `Column` | `-col` / `--column` | the column the mode partitions on |
|
|
578
611
|
| `Row` | `-row` / `--row` | rows per file (`Mode=splitrow`) |
|
|
579
|
-
| `DateFrom` | `-df` / `--datefrom` | start / anchor date, `yyyy-MM-dd` |
|
|
580
|
-
| `DateTo` | `-dt` / `--dateto` | end date, `yyyy-MM-dd` (`Mode=date`) |
|
|
612
|
+
| `DateFrom` | `-df` / `--datefrom` | start / anchor date, `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` |
|
|
613
|
+
| `DateTo` | `-dt` / `--dateto` | end date, `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (`Mode=date`) |
|
|
581
614
|
| `DaysRelative` | `-dr` / `--daysrelative` | days back from `DateFrom` (`Mode=relativedate`) |
|
|
582
615
|
| `MonthsRelative` | `-mr` / `--monthsrelative` | months back from `DateFrom` (`Mode=monthbydate`) |
|
|
583
616
|
| `RemoveExisting` | `-rm` / `--removeexisting` | `Yes`: clear `OutputDir` before exporting |
|
|
@@ -352,8 +352,8 @@ All options:
|
|
|
352
352
|
| `-m` | `--mode` | export mode: `groupby` \| `date` \| `relativedate` \| `monthbydate` \| `splitrow` \| `watermark` — see section 3 |
|
|
353
353
|
| `-col` | `--column` | column the mode partitions on |
|
|
354
354
|
| `-row` | `--row` | rows per file (`-m splitrow`) |
|
|
355
|
-
| `-df` | `--datefrom` | start / anchor date `yyyy-MM-dd
|
|
356
|
-
| `-dt` | `--dateto` | end date `yyyy-MM-dd` (`-m date`) |
|
|
355
|
+
| `-df` | `--datefrom` | start / anchor date `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (see *Date tokens*); omitted with `-dr`/`-mr` ⇒ today (system date) |
|
|
356
|
+
| `-dt` | `--dateto` | end date `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (`-m date`) |
|
|
357
357
|
| `-dr` | `--daysrelative` | days back from `-df` (`-m relativedate`) |
|
|
358
358
|
| `-mr` | `--monthsrelative` | months back from `-df` (`-m monthbydate`) |
|
|
359
359
|
| `-rm` | `--removeexisting` | `Yes`: clear the output directory before exporting |
|
|
@@ -386,6 +386,39 @@ All options:
|
|
|
386
386
|
Modes split one query into multiple files. All need `-dir` (output directory)
|
|
387
387
|
+ `-pf` (filename prefix); partition values are always bound SQL parameters.
|
|
388
388
|
|
|
389
|
+
### Date tokens for `-df` / `-dt` (`DateFrom` / `DateTo`)
|
|
390
|
+
|
|
391
|
+
Instead of a fixed `yyyy-MM-dd`, both accept the current date of the machine
|
|
392
|
+
running the export, optionally shifted by whole days:
|
|
393
|
+
|
|
394
|
+
| Token | Meaning |
|
|
395
|
+
|-------|---------|
|
|
396
|
+
| `@@CURRENT_DATE@@` | today |
|
|
397
|
+
| `@@CURRENT_DATE@@-N@@` | today minus N days, e.g. `@@CURRENT_DATE@@-7@@` |
|
|
398
|
+
| `@@CURRENT_DATE@@+N@@` | today plus N days, e.g. `@@CURRENT_DATE@@+1@@` |
|
|
399
|
+
|
|
400
|
+
`N` is a plain integer (`-1`, `-30`, `-100`, `+10` …). The token is
|
|
401
|
+
case-insensitive. Anything else — a missing closing `@@`, a non-integer, a
|
|
402
|
+
space, a double sign — is rejected with a validation error before anything runs.
|
|
403
|
+
Handy in job files that run daily:
|
|
404
|
+
|
|
405
|
+
```ini
|
|
406
|
+
[Last7Days]
|
|
407
|
+
Source=DB01
|
|
408
|
+
Query=SELECT * FROM sales
|
|
409
|
+
Mode=date
|
|
410
|
+
Column=txn_date
|
|
411
|
+
DateFrom=@@CURRENT_DATE@@-7@@
|
|
412
|
+
DateTo=@@CURRENT_DATE@@-1@@
|
|
413
|
+
OutputDir=out/last7
|
|
414
|
+
BaseName=sales
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
ping-dataexport -s DB01 -q "SELECT * FROM sales" -m date -col txn_date \
|
|
419
|
+
-df "@@CURRENT_DATE@@-7@@" -dt "@@CURRENT_DATE@@" -dir last7 -pf sales
|
|
420
|
+
```
|
|
421
|
+
|
|
389
422
|
**`groupby` — one file per distinct value of a column:**
|
|
390
423
|
|
|
391
424
|
```bash
|
|
@@ -532,8 +565,8 @@ Every job.ini key and the CLI option it mirrors (keys are case-insensitive):
|
|
|
532
565
|
| `Mode` | `-m` / `--mode` | `groupby` / `date` / `relativedate` / `monthbydate` / `splitrow` / `watermark` |
|
|
533
566
|
| `Column` | `-col` / `--column` | the column the mode partitions on |
|
|
534
567
|
| `Row` | `-row` / `--row` | rows per file (`Mode=splitrow`) |
|
|
535
|
-
| `DateFrom` | `-df` / `--datefrom` | start / anchor date, `yyyy-MM-dd` |
|
|
536
|
-
| `DateTo` | `-dt` / `--dateto` | end date, `yyyy-MM-dd` (`Mode=date`) |
|
|
568
|
+
| `DateFrom` | `-df` / `--datefrom` | start / anchor date, `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` |
|
|
569
|
+
| `DateTo` | `-dt` / `--dateto` | end date, `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (`Mode=date`) |
|
|
537
570
|
| `DaysRelative` | `-dr` / `--daysrelative` | days back from `DateFrom` (`Mode=relativedate`) |
|
|
538
571
|
| `MonthsRelative` | `-mr` / `--monthsrelative` | months back from `DateFrom` (`Mode=monthbydate`) |
|
|
539
572
|
| `RemoveExisting` | `-rm` / `--removeexisting` | `Yes`: clear `OutputDir` before exporting |
|
|
@@ -20,3 +20,16 @@ Source=SQLITE01
|
|
|
20
20
|
Query=SELECT * FROM sales
|
|
21
21
|
Output=out/full_dump.parquet
|
|
22
22
|
Format=parquet
|
|
23
|
+
|
|
24
|
+
[Last7Days]
|
|
25
|
+
; DateFrom/DateTo accept @@CURRENT_DATE@@, @@CURRENT_DATE@@-N@@, @@CURRENT_DATE@@+N@@
|
|
26
|
+
; (N = whole days; the date is the system date of the machine running the export)
|
|
27
|
+
Source=SQLITE01
|
|
28
|
+
Query=SELECT * FROM sales
|
|
29
|
+
Mode=date
|
|
30
|
+
Column=txn_date
|
|
31
|
+
DateFrom=@@CURRENT_DATE@@-7@@
|
|
32
|
+
DateTo=@@CURRENT_DATE@@-1@@
|
|
33
|
+
OutputDir=out/last7
|
|
34
|
+
BaseName=sales
|
|
35
|
+
Format=csv
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ping-dataexport"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.1"
|
|
8
8
|
description = "PING's Data Export Tool - To Parquet/CSV/TEXT as Accelerator for Data & AI Project"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -11,7 +11,7 @@ The package uses relative imports only and has no import-time side effects, so
|
|
|
11
11
|
the directory can be copied into any project and imported directly.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
__version__ = "0.4.
|
|
14
|
+
__version__ = "0.4.1"
|
|
15
15
|
__author__ = "Vorapol Ping (ping-godhand)"
|
|
16
16
|
__organization__ = "Godhand.DEV"
|
|
17
17
|
__url__ = "https://github.com/ping-godhand"
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
+
import re
|
|
8
9
|
from dataclasses import dataclass, replace
|
|
9
10
|
from datetime import date, datetime, timedelta
|
|
10
11
|
from typing import Optional, Tuple
|
|
@@ -86,14 +87,42 @@ class JobSpec:
|
|
|
86
87
|
return self.output is None and self.outputdir is None
|
|
87
88
|
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
#: DateFrom / DateTo token: the machine's current date, optionally shifted by whole days.
|
|
91
|
+
CURRENT_DATE_TOKEN = "@@CURRENT_DATE@@"
|
|
92
|
+
_CURRENT_DATE_RE = re.compile(r"^@@CURRENT_DATE@@(?:([+-]\d+)@@)?$")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def parse_strict_date(value: str, *, what: str, today: Optional[date] = None) -> date:
|
|
96
|
+
"""Strict yyyy-MM-dd, or the @@CURRENT_DATE@@ token — anything else is a
|
|
97
|
+
validation error (exit 1).
|
|
98
|
+
|
|
99
|
+
Token forms (case-insensitive, days offset parsed as a plain int):
|
|
100
|
+
@@CURRENT_DATE@@ today (system date of the machine running the export)
|
|
101
|
+
@@CURRENT_DATE@@-7@@ today minus 7 days
|
|
102
|
+
@@CURRENT_DATE@@+1@@ today plus 1 day
|
|
103
|
+
"""
|
|
104
|
+
text = value.strip()
|
|
105
|
+
if text.upper().startswith(CURRENT_DATE_TOKEN):
|
|
106
|
+
m = _CURRENT_DATE_RE.match(text.upper())
|
|
107
|
+
if not m:
|
|
108
|
+
raise JobValidationError(
|
|
109
|
+
f"{what}: bad date token {value!r} — use @@CURRENT_DATE@@, "
|
|
110
|
+
f"@@CURRENT_DATE@@-N@@ or @@CURRENT_DATE@@+N@@ (N = whole days)"
|
|
111
|
+
)
|
|
112
|
+
base = today or date.today()
|
|
113
|
+
offset = int(m.group(1)) if m.group(1) else 0
|
|
114
|
+
try:
|
|
115
|
+
return base + timedelta(days=offset)
|
|
116
|
+
except OverflowError:
|
|
117
|
+
raise JobValidationError(f"{what}: day offset {offset:+d} is out of range") from None
|
|
91
118
|
try:
|
|
92
|
-
parsed = datetime.strptime(
|
|
119
|
+
parsed = datetime.strptime(text, "%Y-%m-%d").date()
|
|
93
120
|
except ValueError:
|
|
94
|
-
raise JobValidationError(
|
|
121
|
+
raise JobValidationError(
|
|
122
|
+
f"{what} must be yyyy-MM-dd or @@CURRENT_DATE@@[±N@@], got {value!r}"
|
|
123
|
+
) from None
|
|
95
124
|
# strptime accepts e.g. '2026-1-2'; enforce the canonical zero-padded form
|
|
96
|
-
if parsed.isoformat() !=
|
|
125
|
+
if parsed.isoformat() != text:
|
|
97
126
|
raise JobValidationError(f"{what} must be yyyy-MM-dd, got {value!r}")
|
|
98
127
|
return parsed
|
|
99
128
|
|
|
@@ -170,8 +199,10 @@ class JobSpecBuilder:
|
|
|
170
199
|
datefrom_v = layered("datefrom")
|
|
171
200
|
dateto_v = layered("dateto")
|
|
172
201
|
|
|
173
|
-
datefrom = parse_strict_date(datefrom_v, what="--datefrom")
|
|
174
|
-
|
|
202
|
+
datefrom = (parse_strict_date(datefrom_v, what="--datefrom", today=self.today)
|
|
203
|
+
if datefrom_v else None)
|
|
204
|
+
dateto = (parse_strict_date(dateto_v, what="--dateto", today=self.today)
|
|
205
|
+
if dateto_v else None)
|
|
175
206
|
if mode in ("relativedate", "monthbydate") and datefrom is None:
|
|
176
207
|
datefrom = self.today # -dr/-mr without -df: anchor = current system date
|
|
177
208
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ping-dataexport
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: PING's Data Export Tool - To Parquet/CSV/TEXT as Accelerator for Data & AI Project
|
|
5
5
|
Author: Vorapol Ping (ping-godhand)
|
|
6
6
|
Maintainer: Godhand.DEV
|
|
@@ -396,8 +396,8 @@ All options:
|
|
|
396
396
|
| `-m` | `--mode` | export mode: `groupby` \| `date` \| `relativedate` \| `monthbydate` \| `splitrow` \| `watermark` — see section 3 |
|
|
397
397
|
| `-col` | `--column` | column the mode partitions on |
|
|
398
398
|
| `-row` | `--row` | rows per file (`-m splitrow`) |
|
|
399
|
-
| `-df` | `--datefrom` | start / anchor date `yyyy-MM-dd
|
|
400
|
-
| `-dt` | `--dateto` | end date `yyyy-MM-dd` (`-m date`) |
|
|
399
|
+
| `-df` | `--datefrom` | start / anchor date `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (see *Date tokens*); omitted with `-dr`/`-mr` ⇒ today (system date) |
|
|
400
|
+
| `-dt` | `--dateto` | end date `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (`-m date`) |
|
|
401
401
|
| `-dr` | `--daysrelative` | days back from `-df` (`-m relativedate`) |
|
|
402
402
|
| `-mr` | `--monthsrelative` | months back from `-df` (`-m monthbydate`) |
|
|
403
403
|
| `-rm` | `--removeexisting` | `Yes`: clear the output directory before exporting |
|
|
@@ -430,6 +430,39 @@ All options:
|
|
|
430
430
|
Modes split one query into multiple files. All need `-dir` (output directory)
|
|
431
431
|
+ `-pf` (filename prefix); partition values are always bound SQL parameters.
|
|
432
432
|
|
|
433
|
+
### Date tokens for `-df` / `-dt` (`DateFrom` / `DateTo`)
|
|
434
|
+
|
|
435
|
+
Instead of a fixed `yyyy-MM-dd`, both accept the current date of the machine
|
|
436
|
+
running the export, optionally shifted by whole days:
|
|
437
|
+
|
|
438
|
+
| Token | Meaning |
|
|
439
|
+
|-------|---------|
|
|
440
|
+
| `@@CURRENT_DATE@@` | today |
|
|
441
|
+
| `@@CURRENT_DATE@@-N@@` | today minus N days, e.g. `@@CURRENT_DATE@@-7@@` |
|
|
442
|
+
| `@@CURRENT_DATE@@+N@@` | today plus N days, e.g. `@@CURRENT_DATE@@+1@@` |
|
|
443
|
+
|
|
444
|
+
`N` is a plain integer (`-1`, `-30`, `-100`, `+10` …). The token is
|
|
445
|
+
case-insensitive. Anything else — a missing closing `@@`, a non-integer, a
|
|
446
|
+
space, a double sign — is rejected with a validation error before anything runs.
|
|
447
|
+
Handy in job files that run daily:
|
|
448
|
+
|
|
449
|
+
```ini
|
|
450
|
+
[Last7Days]
|
|
451
|
+
Source=DB01
|
|
452
|
+
Query=SELECT * FROM sales
|
|
453
|
+
Mode=date
|
|
454
|
+
Column=txn_date
|
|
455
|
+
DateFrom=@@CURRENT_DATE@@-7@@
|
|
456
|
+
DateTo=@@CURRENT_DATE@@-1@@
|
|
457
|
+
OutputDir=out/last7
|
|
458
|
+
BaseName=sales
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
ping-dataexport -s DB01 -q "SELECT * FROM sales" -m date -col txn_date \
|
|
463
|
+
-df "@@CURRENT_DATE@@-7@@" -dt "@@CURRENT_DATE@@" -dir last7 -pf sales
|
|
464
|
+
```
|
|
465
|
+
|
|
433
466
|
**`groupby` — one file per distinct value of a column:**
|
|
434
467
|
|
|
435
468
|
```bash
|
|
@@ -576,8 +609,8 @@ Every job.ini key and the CLI option it mirrors (keys are case-insensitive):
|
|
|
576
609
|
| `Mode` | `-m` / `--mode` | `groupby` / `date` / `relativedate` / `monthbydate` / `splitrow` / `watermark` |
|
|
577
610
|
| `Column` | `-col` / `--column` | the column the mode partitions on |
|
|
578
611
|
| `Row` | `-row` / `--row` | rows per file (`Mode=splitrow`) |
|
|
579
|
-
| `DateFrom` | `-df` / `--datefrom` | start / anchor date, `yyyy-MM-dd` |
|
|
580
|
-
| `DateTo` | `-dt` / `--dateto` | end date, `yyyy-MM-dd` (`Mode=date`) |
|
|
612
|
+
| `DateFrom` | `-df` / `--datefrom` | start / anchor date, `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` |
|
|
613
|
+
| `DateTo` | `-dt` / `--dateto` | end date, `yyyy-MM-dd` or `@@CURRENT_DATE@@[±N@@]` (`Mode=date`) |
|
|
581
614
|
| `DaysRelative` | `-dr` / `--daysrelative` | days back from `DateFrom` (`Mode=relativedate`) |
|
|
582
615
|
| `MonthsRelative` | `-mr` / `--monthsrelative` | months back from `DateFrom` (`Mode=monthbydate`) |
|
|
583
616
|
| `RemoveExisting` | `-rm` / `--removeexisting` | `Yes`: clear `OutputDir` before exporting |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport/db/postgres_connector.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{ping_dataexport-0.4.0 → ping_dataexport-0.4.1}/src/ping_dataexport.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|