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_util-0.0.12.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

general_util-0.0.12-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file general_util-0.0.12.tar.gz.

File metadata

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

File hashes

Hashes for general_util-0.0.12.tar.gz
Algorithm Hash digest
SHA256 5e38f9b8023ecc1c12c7bd9b867cfe7de2265c814b23c444904a23abf834431e
MD5 8b8895638f9e2694f7f73c9af32994fd
BLAKE2b-256 e66eff9d15a08dc24b38282e8b0890b8483f7e658f5242efed7d1db309b9555c

See more details on using hashes here.

File details

Details for the file general_util-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for general_util-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 7e1cfca7d14a78f2283de3e2fdc7c1d03327747295c414d399b0f72d8d96fafc
MD5 91265e7be83106b9a66117c38e4be18c
BLAKE2b-256 214e8d4c70f168be92f5848265541434b9178828d98661f2b89335a17d4f01a7

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