Skip to main content

general operator for fastapi write sql and redis

Project description

node_object_module version 2.3.3

  • API node rule
    1. API node 包含四張表(node, node_base, device_info, third_dimension_instance)一對一關係
    2. 只能透過API node的update去修改或新增device_info和third_dimension_instance這兩張表
    3. node只能有一個parent node, 可以有多個child nodes
    4. 跟node groups的關係是多對多
    5. 刪除node會連同底下所有的child nodes和所有此node和child nodes底下的object都刪除 node_delete.png
  • API object rule
    1. API object 包含四張表(object, object_base, fake_data_config, fake_data_config_base)一對一關係
    2. 只能透過API object的update去修改或新增其他一對一的表
    3. object只能綁定一個node
    4. 跟object groups的關係是多對多
    5. insert object的value會完全取代原本的value, 只修改redis的表, 不修改sql
  • API object value
    1. history value儲存在influxDB
    2. latest value存redis和influxDB
    3. 取得history value從influxDB讀取
    4. 取得latest value從redis取
    5. 取得即時有改變的資料使用websocket連線(ws://{host}:{port}/ws/)
  • API control href group
    1. create 可以創建group 和 item
    2. update 如果item有帶id就是修改, 如果沒有帶id就是創建新的item, 如果帶負數id會刪除此item
    3. delete 會連同底下item一起刪除

Design

design.png

General Table Operate CRUD

Read Data Read.png

Create Data Create.png

Update Data Update.png

Delete Data Delete.png

DB diagram

DB schemas

db_node_object.png

Deploy

1. Use docker-compose

  1. install mysql, redis and influxdb

    docker pull mssql

    docker pull redis

    docker pull influxdb

  2. start docker-compose.yaml

    docker-compose up --build -d

2. Use Dockerfile

需要先啟動mysql, redis, influxdb 可用環境變數db_host, redis_host去改變sql和redis的連線ip

  1. build docker image "node_object"

    docker build -t node_object:latest .

  2. run node_object image

    docker run --name node_object --network="host" -p 9330:9330 node_object:latest

    有環境變數 docker run --name node_object --network="host" -e db_host=192.168.1.11 -e redis_host=192.168.1.11 -e influx_host=192.168.1.11 -p 9330:9330 -d node_object:latest

Swagger API Document

http://{host}:{port}/docs swagger.png

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

general_operator-0.2.13.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

general_operator-0.2.13-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file general_operator-0.2.13.tar.gz.

File metadata

  • Download URL: general_operator-0.2.13.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.1

File hashes

Hashes for general_operator-0.2.13.tar.gz
Algorithm Hash digest
SHA256 5a986af9836daa34c44996f16a46c9385117f8237bf0b6c7687a5fe43401b36b
MD5 1c02b4bc76070c86c172c55a3fa2285e
BLAKE2b-256 482ea5eaf580b0b939292dd30b6c9b0b5357324545cd93a7a5019bb7e62d8464

See more details on using hashes here.

File details

Details for the file general_operator-0.2.13-py3-none-any.whl.

File metadata

File hashes

Hashes for general_operator-0.2.13-py3-none-any.whl
Algorithm Hash digest
SHA256 ce59fb22c8b6fcfec14b0e237c7e9c7351aed2d0aae757a6feb857f93efb21c2
MD5 a8c54843aaf6e0694f9cd60430874532
BLAKE2b-256 85505dd7bd2803c79615a3fed26b78a6d65a2a80fac3fcf1f1476fc4fba008cf

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