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.12.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: general_operator-0.2.12.tar.gz
  • Upload date:
  • Size: 15.0 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.12.tar.gz
Algorithm Hash digest
SHA256 5635819112f64cadc25d445bff4e36dbfc530a84cc41ae43fb1955414002bf96
MD5 2193b82ccade9ba9e7bdaa82a629fa4f
BLAKE2b-256 b132a46b78711dc24170106c280291b6e1e6059b0c28f6b82f7be9b0c07f7c3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for general_operator-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 4fb0272598ebdba97bb2967d0e274b5b3942159501e701f6181075e3c735c2d6
MD5 7d874bc47002f7c5c960151156c18f80
BLAKE2b-256 68204bbc6212043b4cb25abb929b90c791c981812ad19a29f15c57abafccfa46

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