Git Product home page Git Product logo

file-json's Introduction

file-json

In many scenarios, you may want to save a huge list, dict object and use it later.
The standard json package will load all the data into memroy.
Hence comes the file-json library. With this package, you can store the list, dict object to local file system.

How it works

all the rules should

  1. Each object was store in a directory, the data was store in *.json.gz
  2. the .file_json.json file contains some basic info of this object.
  3. for time base list, the directory looks like this.
.file_json.json
{
    "type": "time_based_list",
    "key": "create_datetime",
}
2023
  - 12
    - 19
      - 00.json.gz  # this file contains data from 2023-12-19 00:00:00 to 2023-12-19 01:00:00(exclude 2023-12-19 01:00:00)
      - 01.json.gz
      - 02  # if there were too much data between 2023-12-19 02:00:00 and 2023-12-10 03:00:00
        - 00.json.gz
        - 01.json.gz
    - 20
2024
  - 01
    - 01
  1. for huge size of list, the directory looks like this.
.file_json.json
{
    "type": "sorted_list",
    "key": "id",
}
- 00.json.gz
- 01.json.gz
- 02
    - 01.json.gz
    - 02.json.gz
- 03.json.gz
  1. for huge size of dict, the directory looks like this.
.file_json.json
{
    "type": "dict",
}
- key1.json.gz
- key2
    - key2_1.json.gz
    - key2_2.json.gz
- key3.json.gz

AsciiDict

the key will be used as filename. so special characters should not used in the key

root_path
    - .file.json
    - key1
        key1_1.json.gz
        key1_2.json.gz
    - key2
        key2_1.json.gz
        key2_2.json.gz
    ...

Features

  • support time base list
    • support datetime with timezone
  • support huge size of list
  • support huge size of dict
  • use filelock to handle concurrency

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install file-json

License

file-json is distributed under the terms of the MIT license.

file-json's People

Contributors

ramwin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.