Hi,
From an ESP model we want to update a db table which has column defined as serial key (SERIAL PRIMARY KEY).
In this way postgres creates a auto incremented, unique identifier.
How do we define this column in the ESP schema?
We've tried several options: to insert data into a DB table, ESP expects a field for each column in the schema.
The functional window which writes the values to db looks like this:
<window-functional pubsub="true" name="B03_Write_raw_sensor_data">
<schema>
<fields>
<field name="raw_sensor_data_id" type="string"/>
<field name="esp_id" type="int64" key="true"/>
<field name="sensor_id" type="int64" key="true"/>
<field name="sensor_status" type="string"/>
<field name="sensor_status_description" type="string"/>
<field name="phenomenom_time" type="date" key="true"/>
<field name="value" type="double"/>
<field name="unit" type="string"/>
<field name="raw_sensor_output" type="string"/>
<field name="load_time" type="date"/>
<field name="sensor_metadata_id_from_sensor_metadata" type="int64"/>
<field name="access_license_id_from_access_license" type="int64"/>
<field name="quantity" type="string" key="true"/>
</fields>
</schema>
<function-context>
<functions>
<function name="load_time"><![CDATA[timeCurrent()]]></function>
<function name="access_license_id_from_access_license"><![CDATA[1]]></function>
<function name="raw_sensor_data_id"><![CDATA[concat(esp_id,sensor_id,phenomenom_time,quantity)]]></function>
<function name="sensor_metadata_id_from_sensor_metadata"><![CDATA[sensor_metadata_id]]></function>
</functions>
</function-context>
<connectors>
<connector class="db" name="raw_sensor_data">
<properties>
<property name="type"><![CDATA[sub]]></property>
<property name="snapshot"><![CDATA[false]]></property>
<property name="connectstring"><![CDATA[DSN=lmw_tmp;uid=??;pwd=??;]]></property>
<property name="desttablename"><![CDATA[@schema@.raw_sensor_data]]></property>
</properties>
</connector>
</connectors>
</window-functional>
As a workaround now, we use a concatenation of several fields (concat(esp_id,sensor_id,phenomenom_time,quantity).
Postgres is the database, working with ESP 5.1.
Ebele Veenstra
RWS