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.26.tar.gz (7.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.26-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typetwo-1.0.26.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for typetwo-1.0.26.tar.gz
Algorithm Hash digest
SHA256 07471d881974aac4dc9f3e642c30a75942d886882f5301c98dcffea98e4ca2ad
MD5 54e692e3ad4bc584204118fc82d924ec
BLAKE2b-256 07029a8ae11fb3abbe9f808cd77ba847e549fbd32e5a26a04f397f4f3e531680

See more details on using hashes here.

File details

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

File metadata

  • Download URL: typetwo-1.0.26-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11

File hashes

Hashes for typetwo-1.0.26-py3-none-any.whl
Algorithm Hash digest
SHA256 454e2c63651e039e9c359b7096af0de4ff6506dc8dfd403399820c33648f7511
MD5 0ace696f0b46a3e0fb259aafb740c121
BLAKE2b-256 e87672b7504e5210fee6f45d707894b4ac5f8d52dc799747e3468596db7a86ff

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