mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
doc update
This commit is contained in:
@ -41,8 +41,8 @@ Schema:
|
|||||||
{
|
{
|
||||||
"key": string,
|
"key": string,
|
||||||
"cells": {
|
"cells": {
|
||||||
string: {
|
<string>: { # column family
|
||||||
string: string
|
<string>: string # column: value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,8 +57,10 @@ Schema (raw):
|
|||||||
{
|
{
|
||||||
"column_family": string,
|
"column_family": string,
|
||||||
"column": string,
|
"column": string,
|
||||||
"timestamp": string,
|
"value": string,
|
||||||
"value": string
|
"timestamp_iso": string,
|
||||||
|
"timestamp_epoch": integer,
|
||||||
|
"timestamp_epoch_utc": integer
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -86,8 +88,10 @@ Examples:
|
|||||||
{
|
{
|
||||||
"column_family": "foo",
|
"column_family": "foo",
|
||||||
"column": "bar",
|
"column": "bar",
|
||||||
"timestamp": "1970-01-01T01:00:00",
|
"value": "baz1",
|
||||||
"value": "baz"
|
"timestamp_iso": "1970-01-01T01:00:00",
|
||||||
|
"timestamp_epoch": 32400,
|
||||||
|
"timestamp_epoch_utc": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ Schema:
|
|||||||
{
|
{
|
||||||
"key": string,
|
"key": string,
|
||||||
"cells": {
|
"cells": {
|
||||||
string: {
|
<string>: { # column family
|
||||||
string: string
|
<string>: string # column: value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,8 +52,10 @@ Schema (raw):
|
|||||||
{
|
{
|
||||||
"column_family": string,
|
"column_family": string,
|
||||||
"column": string,
|
"column": string,
|
||||||
"timestamp": string,
|
"value": string,
|
||||||
"value": string
|
"timestamp_iso": string,
|
||||||
|
"timestamp_epoch": integer,
|
||||||
|
"timestamp_epoch_utc": integer
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -81,14 +83,15 @@ Examples:
|
|||||||
{
|
{
|
||||||
"column_family": "foo",
|
"column_family": "foo",
|
||||||
"column": "bar",
|
"column": "bar",
|
||||||
"timestamp": "1970-01-01T01:00:00",
|
"value": "baz1",
|
||||||
"value": "baz"
|
"timestamp_iso": "1970-01-01T01:00:00",
|
||||||
|
"timestamp_epoch": 32400,
|
||||||
|
"timestamp_epoch_utc": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
import datetime
|
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
from jc.jc_types import JSONDictType
|
from jc.jc_types import JSONDictType
|
||||||
@ -171,15 +174,14 @@ def parse(
|
|||||||
if field.startswith(" " * 4):
|
if field.startswith(" " * 4):
|
||||||
value = field.strip(' "')
|
value = field.strip(' "')
|
||||||
if value_next:
|
if value_next:
|
||||||
dt = jc.utils.timestamp(timestamp)
|
dt = jc.utils.timestamp(timestamp, format_hint=(1750, 1755))
|
||||||
cells.append({
|
cells.append({
|
||||||
"column_family": column_name.split(":", 1)[0],
|
"column_family": column_name.split(":", 1)[0],
|
||||||
"column": column_name.split(":", 1)[1],
|
"column": column_name.split(":", 1)[1],
|
||||||
# "timestamp": datetime.datetime.strptime(timestamp, "%Y/%m/%d-%H:%M:%S.%f").isoformat(),
|
"value": value,
|
||||||
"timestamp_iso": dt.iso,
|
"timestamp_iso": dt.iso,
|
||||||
"timestamp_epoch": dt.naive,
|
"timestamp_epoch": dt.naive,
|
||||||
"timestamp_epoch_utc": dt.utc,
|
"timestamp_epoch_utc": dt.utc
|
||||||
"value": value
|
|
||||||
})
|
})
|
||||||
elif field.startswith(" " * 2):
|
elif field.startswith(" " * 2):
|
||||||
column_name, timestamp = map(str.strip, field.split("@"))
|
column_name, timestamp = map(str.strip, field.split("@"))
|
||||||
|
Reference in New Issue
Block a user