Skip to main content

Helper for type-II Slowly Changing Dimensions, as well as ISO Json loading and dumping

Project description

Type Two

Provides a simple set of classes for handling type-II slowly changing dimension style data. Also provides helper classes for reading and writing JSON payloads with ISO-compliant dates.

Example Usage: TypeTwo

rows = [
   {"id": 1, "name": "Henry", "age": 34}
   {"id": 2, "name": "Fred", "age" : 42}
]

history = TypeType(rows, RowKey("id"), from_field = "start", to_field = "end")
iter(history)
>>> {"id": 1, "name": "Henry", "age": 34, "start": datetime(1900,1,1),  "end": datetime(2999,12,31)}
>>> {"id": 2, "name": "Fred",  "age": 42, "start": datetime(1900,1,1),  "end": datetime(2999,12,31)}


history += {"id": 1, "name": "Henry", "age": 37}
iter(history)
>>> {"id": 1, "name": "Henry", "age": 34, "start": datetime(1900,1,1),  "end": datetime(2022,6,12,3,0,0)}
>>> {"id": 1, "name": "Henry", "age": 37, "start": datetime(2022,6,12,3,0,0), "end": datetime(2999,12,31)}
>>> {"id": 2, "name": "Fred",  "age": 42, "start": datetime(1900,1,1),  "end": datetime(2999,12,31)}

history += [
   {"id": 1, "name": "Henry", "age": 99}
   {"id": 2, "name": "Fred", "age": 99}
]

iter(history)
>>> {"id": 1, "name": "Henry", "age": 34, "start": datetime(1900,1,1),        "end": datetime(2022,6,12,3,0,0)}
>>> {"id": 1, "name": "Henry", "age": 37, "start": datetime(2022,6,12,3,0,0), "end": datetimedatetime(2022,6,12,3,15,0)}
>>> {"id": 1, "name": "Henry", "age": 99, "start": datetime(2022,6,12,3,15,0),"end": datetime(2999,12,31)}
>>> {"id": 2, "name": "Fred",  "age": 42, "start": datetime(1900,1,1),        "end": datetime(2022,6,12,3,15,0)}
>>> {"id": 2, "name": "Fred",  "age": 99, "start": datetime(2022,6,12,3,15,0),"end": datetime(2999,12,31)}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

typetwo-1.0.11.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typetwo-1.0.11-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file typetwo-1.0.11.tar.gz.

File metadata

  • Download URL: typetwo-1.0.11.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for typetwo-1.0.11.tar.gz
Algorithm Hash digest
SHA256 6afbca4243639ccaae32f25897e2247db95cb5f969980ad341ca0bc8f2776ec4
MD5 79e27e2cc01a11f8617f8ff5386f04d0
BLAKE2b-256 685c956c0dee08cdf596a7f46609fbcb3b82c41e7b16bd6d2f0c0be3c39a8cbb

See more details on using hashes here.

File details

Details for the file typetwo-1.0.11-py3-none-any.whl.

File metadata

  • Download URL: typetwo-1.0.11-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for typetwo-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 b84c639291092b1065842d48c56986c54186a7bc5921aa1e5a753c581aed4fa9
MD5 d9bf2d1e8d81eaf3a09979edea7f1065
BLAKE2b-256 6067401854249abc148cca2c7c1db975d82703f67b9b4c56297bab764a1b7b1d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page