-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding snapshot source support (#20)
* adding snapshot source support * resolving merge * fix issue * fix * make sure all paths are valid * source updated to correct field type * adding more tests for inflate sources * fix date range logic * added export step tests * added snapshot source to e2e tests * bump version and upd readme
- Loading branch information
1 parent
f2bf2a4
commit 54cca40
Showing
19 changed files
with
771 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
cli-e2e-test/data/device_seen_snapshot/data_dt=20220102/part-1.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
device,last_seen | ||
IPhone1,2021-12-31 | ||
IPhone2,2021-12-30 |
3 changes: 3 additions & 0 deletions
3
cli-e2e-test/expected_results/test_scenario1_model/device_seen_snapshot_csv.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
device,last_seen | ||
IPhone1,2022-01-05 | ||
IPhone2,2022-01-05 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
bound import_config:device_seen_snapshot:schema | ||
bound syntax:header | ||
|
||
module device_seen_snapshot | ||
def DEVICE_NAME[idx, row] = source_catalog:device_seen_snapshot[idx, :device, row] | ||
def LAST_SEEN[idx, row] = source_catalog:device_seen_snapshot[idx, :last_seen, row] | ||
end | ||
|
||
/* | ||
* device_seen snapshot is a snapshot of the last time a device was seen, which is | ||
* essentially an aggregation over the snapshot data and the current day's data | ||
* found in the `device` relation. | ||
*/ | ||
|
||
def current_date = max[source:spans[_]] | ||
def device_seen_today(n, t) { | ||
device:name(n) and | ||
t = current_date | ||
} | ||
|
||
def device_last_seen[d] = max[t: | ||
device_seen_today(d, t) | ||
or | ||
( | ||
device_seen_snapshot:DEVICE_NAME(idx, row, d) and | ||
device_seen_snapshot:LAST_SEEN(idx, row, t) | ||
from idx, row | ||
) | ||
] | ||
|
||
module device_seen_snapshot_updated | ||
def device(k, d) { device_last_seen(d, _) and k = d } | ||
def last_seen(d, t) { device_last_seen(d, t) } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.