Changeset: d18a2dfe460d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d18a2dfe460d
Modified Files:
clients/iotapi/documentation/websockets_api.rst
clients/iotclient/documentation/restful_resources.rst
clients/iotclient/src/Streams/jsonschemas.py
clients/iotclient/src/Streams/streamscreator.py
Branch: iot
Log Message:
Updated documentation, corrected some JSON schemas listings and parsing
diffs (truncated from 322 to 300 lines):
diff --git a/clients/iotapi/documentation/websockets_api.rst
b/clients/iotapi/documentation/websockets_api.rst
--- a/clients/iotapi/documentation/websockets_api.rst
+++ b/clients/iotapi/documentation/websockets_api.rst
@@ -233,42 +233,44 @@ Returns a info message regarding all the
"response": "data",
"streams_count": 1,
"streams_listing": [
- "schema": "measures",
- "stream": "temperature",
- "columns": [
- {
- "name": "sensorid",
- "type": "clob",
- "nullable": false,
- "default": "living room"
- },
- {
- "name": "temperature",
- "type": "real",
- "nullable": false,
- "default": null
- },
- {
- "name": "implicit_timestamp",
- "type": "timestamp with time zone",
- "nullable": false,
- "default": null
- }
- ],
- "baskets_count": 3,
- "baskets_listing": [
- {
- "number": 1,
- "count": 20
- },
- {
- "number": 2,
- "count": 25
- },
- {
- "number": 3,
- "count": 12
- }
- ]
+ {
+ "schema": "measures",
+ "stream": "temperature",
+ "columns": [
+ {
+ "name": "sensorid",
+ "type": "clob",
+ "nullable": false,
+ "default": "living room"
+ },
+ {
+ "name": "temperature",
+ "type": "real",
+ "nullable": false,
+ "default": null
+ },
+ {
+ "name": "implicit_timestamp",
+ "type": "timestamp with time zone",
+ "nullable": false,
+ "default": null
+ }
+ ],
+ "baskets_count": 3,
+ "baskets_listing": [
+ {
+ "number": 1,
+ "count": 20
+ },
+ {
+ "number": 2,
+ "count": 25
+ },
+ {
+ "number": 3,
+ "count": 12
+ }
+ ]
+ }
]
}
diff --git a/clients/iotclient/documentation/restful_resources.rst
b/clients/iotclient/documentation/restful_resources.rst
--- a/clients/iotclient/documentation/restful_resources.rst
+++ b/clients/iotclient/documentation/restful_resources.rst
@@ -27,31 +27,31 @@ Returns a JSON file with details about a
{
"streams_count": 1,
"streams_listing": [
- {
- "schema": "measures",
- "stream": "temperature",
- "has_timestamp": true,
- "has_hostname": false,
- "columns": [
- {
- "name": "temperature",
- "type": "real",
- "default": null,
- "nullable": false
- },
- {
- "name": "sensorid",
- "type": "text",
- "default": null,
- "nullable": false
+ {
+ "schema": "measures",
+ "stream": "temperature",
+ "has_timestamp": true,
+ "has_hostname": false,
+ "columns": [
+ {
+ "name": "temperature",
+ "type": "real",
+ "default": null,
+ "nullable": false
+ },
+ {
+ "name": "sensorid",
+ "type": "text",
+ "default": null,
+ "nullable": false
+ }
+ ],
+ "flushing": {
+ "base": "tuple",
+ "interval": 50,
+ "tuples_inserted_per_basket": 0
}
- ],
- "flushing": {
- "base": "tuple",
- "interval": 50
- "tuples_inserted_per_basket": 0
}
- }
]
}
@@ -60,32 +60,32 @@ Returns a JSON file with details about a
**POST**
-Creates a stream using a pre-defined JSON schema. The JSON must include the
stream's schema, the stream's name, the stream's columns and the flushing
method. The flushing can be either time based, tuple based or automatic
(:code:`auto`). For tuple based flushing, the number of tuples to flush must be
provided using the :code:`interval` field. In time based flushing, the
:code:`interval` field tells the time units between flushes and the
:code:`unit` field must be "s", "m" or "h" for seconds, minutes or hours
respectively. In automatic flushing, the baskets are flushed whenever a new
batch is inserted. For columns `see data types for details
<streams_data_types.html#data_types>`__. Additionaly a hostname parameter can
be provided, and if it's true then an additional column will be created with
the iot web server host name.
+Creates a stream using a pre-defined JSON schema. The JSON must include the
stream's schema, the stream's name, the stream's columns and the flushing
method. The flushing can be either time based, tuple based or automatic
(:code:`auto`). For tuple based flushing, the number of tuples to flush must be
provided using the :code:`interval` field. In time based flushing, the
:code:`interval` field tells the time units between flushes and the
:code:`unit` field must be "s", "m" or "h" for seconds, minutes or hours
respectively. In automatic flushing, the baskets are flushed whenever a new
batch is inserted. For columns `see data types for details
<streams_data_types.html#data_types>`__. Additionally a hostname parameter can
be provided, and if it's true then an additional column will be created with
the iot web server hostname.
Bellow is the JSON used to create the stream in streams_:
.. code-block:: json
{
- "schema": "measures",
- "stream": "temperature",
- "hostname": false,
- "flushing": {
- "base": "tuple",
- "interval": 50
- },
- "columns": [
- {
- "name": "temperature",
- "type": "real",
- "nullable": false
- },
- {
- "name": "sensorid",
- "type": "text",
- "nullable": false
- }
- ]
+ "schema": "measures",
+ "stream": "temperature",
+ "has_hostname": false,
+ "flushing": {
+ "base": "tuple",
+ "interval": 50
+ },
+ "columns": [
+ {
+ "name": "temperature",
+ "type": "real",
+ "nullable": false
+ },
+ {
+ "name": "sensorid",
+ "type": "text",
+ "nullable": false
+ }
+ ]
}
**DELETE**
@@ -95,8 +95,8 @@ Deletes an existing stream. Only the str
.. code-block:: json
{
- "schema": "measures",
- "stream": "temperature"
+ "schema": "measures",
+ "stream": "temperature"
}
Application Server
@@ -121,16 +121,16 @@ Insert a batch of tuples on the provided
.. code-block:: json
[
- {
- "sensorid": "living room",
- "temperature": 32.6
- },
- {
- "sensorid": "kitchen",
- "temperature": 34.2
- },
- {
- "sensorid": "bathroom",
- "temperature": 28.9
- }
+ {
+ "sensorid": "living room",
+ "temperature": 32.6
+ },
+ {
+ "sensorid": "kitchen",
+ "temperature": 34.2
+ },
+ {
+ "sensorid": "bathroom",
+ "temperature": 28.9
+ }
]
diff --git a/clients/iotclient/src/Streams/jsonschemas.py
b/clients/iotclient/src/Streams/jsonschemas.py
--- a/clients/iotclient/src/Streams/jsonschemas.py
+++ b/clients/iotclient/src/Streams/jsonschemas.py
@@ -77,7 +77,7 @@ def init_create_streams_schema(add_hugei
"properties": {
"schema": {"type": "string"},
"stream": {"type": "string"},
- "hostname": {"type": "boolean", "default": False},
+ "has_hostname": {"type": "boolean", "default": False},
"flushing": {
"type": "object",
"oneOf": [{
@@ -168,8 +168,8 @@ def init_create_streams_schema(add_hugei
"name": {"type": "string"},
"type": {"type": "string", "enum": [REGEX_TYPE]},
"nullable": {"type": "boolean", "default": True},
- "regex": {"type": "string"},
- "default": {"type": "string"}
+ "default": {"type": "string"},
+ "regex": {"type": "string"}
},
"required": ["name", "type", "regex"],
"additionalProperties": False
@@ -178,8 +178,8 @@ def init_create_streams_schema(add_hugei
"name": {"type": "string"},
"type": {"type": "string", "enum":
BOUNDED_TEXT_INPUTS},
"nullable": {"type": "boolean", "default": True},
- "limit": {"type": "integer", "minimum": 1},
- "default": {"type": "string"}
+ "default": {"type": "string"},
+ "limit": {"type": "integer", "minimum": 1}
},
"required": ["name", "type", "limit"],
"additionalProperties": False
@@ -188,9 +188,9 @@ def init_create_streams_schema(add_hugei
"name": {"type": "string"},
"type": {"type": "string", "enum": [ENUM_TYPE]},
"nullable": {"type": "boolean", "default": True},
+ "default": {"type": "string"},
"values": {"type": "array", "minItems": 1,
"uniqueItems": True,
- "items": {"type": "string"}},
- "default": {"type": "string"}
+ "items": {"type": "string"}}
},
"required": ["name", "type", "values"],
"additionalProperties": False
@@ -230,9 +230,9 @@ def init_create_streams_schema(add_hugei
"name": {"type": "string"},
"type": {"type": "string", "enum": DECIMAL_INPUTS},
"nullable": {"type": "boolean", "default": True},
+ "default": {"type": "number"},
"precision": {"type": "integer", "minimum": 1,
"maximum": max_precision, "default": 18},
"scale": {"type": "integer", "minimum": 0,
"default": 3},
- "default": {"type": "number"},
"minimum": {"type": "number"},
"maximum": {"type": "number"}
},
diff --git a/clients/iotclient/src/Streams/streamscreator.py
b/clients/iotclient/src/Streams/streamscreator.py
--- a/clients/iotclient/src/Streams/streamscreator.py
+++ b/clients/iotclient/src/Streams/streamscreator.py
@@ -76,21 +76,22 @@ def validate_schema_and_create_stream(sc
"items": {"type": "object", "properties": properties, "required":
req_fields, "additionalProperties": False}
}, format_checker=FormatChecker())
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list