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

Uploaded Source

Built Distribution

general_operator-0.2.5-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: general_operator-0.2.5.tar.gz
  • Upload date:
  • Size: 14.7 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.5.tar.gz
Algorithm Hash digest
SHA256 8541811ce643d5dc5d0bc5002260e8aacfd2c684057d98f9f82284cc23d763b3
MD5 e77d855285f57bed250cfb4dc0c0f5da
BLAKE2b-256 4c3da2a4aa413bbbfa1d18fd970df54baff0c37add27e2a1bb48c63ad40d321c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for general_operator-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 081616894ee14df120e1b79e003e228b42cb09065a09ce2e10e42c366c5ec4a2
MD5 82142d5649374f1f36440c808668d136
BLAKE2b-256 2e802a171f7431636c209084b783254961297eb133fada0b6575dfdf8987c650

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