Skip to main content

Config-driven merging and splitting of JSON data files.

Project description

data-file-merge

This python module/CLI allows you to merge multiple JSON files into a single destination JSON file using a set of rules defined in the dfm config file

Please refer to the project wiki for complete documentation including usage and configuration file syntax.

Hello World Example

You can install the CLI for your operating system from GitHub here.

Using the following config file:

{
    "SourceFiles" : [
        {
            "SourceFileLocation" : {
                "Path" : "foo/bar.json"
            },
            "SourceFileNode" : "$",
            "DestinationFileNode" : "$"
        },
        {
            "SourceFileLocation" : {
                "Path" : "foo/baz.json"
            },
            "SourceFileNode" : "$",
            "DestinationFileNode" : "$"
        },
    ],
    "DestinationFile" : {
        "DestinationFileLocation" : {
            "Path" : "hello/world.json"
        }
    }
}

...you are able to merge the content of foo/bar.json and foo/baz.json into hello/world.json (this can either be an existing or new file). The $s indicate that we are merging from the root node of both foo/*.json files to the root of hello/world.json. This merge can be achieved with the CLI command dfm merge --root-path <path to 'foo' directory> <path to this config file>. The specific rules followed by the merging logic can be found in the wiki.

More examples can be found in the dfm example repo.

Considerations

Development

  • install pre-commit hooks: poetry run pre-commit install
  • check and fix linting issues: make format

Contributing to the project

You are welcome to help us rid the world of monolithic data files! Reach out to ServerlessSam to either find some tickets to complete or bring up any ideas you have.

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

data-file-merge-0.3.1.tar.gz (12.3 kB view details)

Uploaded Source

File details

Details for the file data-file-merge-0.3.1.tar.gz.

File metadata

  • Download URL: data-file-merge-0.3.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for data-file-merge-0.3.1.tar.gz
Algorithm Hash digest
SHA256 93fbae88eb4377db7f6283b02795ba225e7fe5b21ea9026bf34c5c5177f01107
MD5 c9edd112a94fa7e9d11c2c9ab1c89e22
BLAKE2b-256 722be3a41e9a0b117b889dd79e8df09e2665d5bfd158a75a8622e8c71cb16186

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