Skip to main content

Convert relational data to tree-like structure (JSON)

Project description

rel2tree

Convert relational data to tree-like structure like JSON. Aggregate, filter your data, make custom computation.

What is this?

Let's suppose you run a business where clients can hold money and can have approved credits in diffrent currencies. You may want to generate a /balance api endpoint that outputs the following result:

  {
    "balances": [
      {
        "clientID": 111,
        "available": [
          {
            "currencyID": "EUR",
            "amount": 125
          }
        ],
        "credit": [
          {
            "currencyID": "EUR",
            "amount": 50
          }
        ],
        "currencies": [
          "EUR"
        ]
      },
      {
        "clientID": 333,
        "available": [
          {
            "currencyID": "EUR",
            "amount": 123
          },
          {
            "currencyID": "GBP",
            "amount": 200
          }
        ],
        "credit": [],
        "currencies": [
          "EUR",
          "GBP"
        ]
      }
    ],
    "clientDetails": [
      {
        "clientID": 222,
        "clientCode": "00222"
      },
      {
        "clientID": 111,
        "clientCode": "00111"
      }
    ]
  }

Install

pip install rel2tree

Usage

TODO

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

rel2tree-5.0.0.tar.gz (2.6 kB view details)

Uploaded Source

File details

Details for the file rel2tree-5.0.0.tar.gz.

File metadata

  • Download URL: rel2tree-5.0.0.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for rel2tree-5.0.0.tar.gz
Algorithm Hash digest
SHA256 9f4a006412df21d876cfa7bebf163135646eef9a3a8f5f8950a7a396e6a04f60
MD5 40e15efb4b3a467ca385d82965be64bd
BLAKE2b-256 615ff1d0fe42c07139bf8db29f5af3daa4736126390dce4e6bda6b73cfa25ebf

See more details on using hashes here.

Supported by

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