.

Average: 0
Rating Count: 0

Development status: New development
Information status: Updated
Repository: http://svn.code.sf.net/p/tango-ds/code/DeviceClasses/Communication/SQLServer
Contact:



Class Description


Device Server for SQLServer Database Access
This device requires Fandango module to be available in the PYTHONPATH.

Families: Communication

Key words:

Language: Python

License:

Contact:

Class interface


Attributes:

Name Description
LastUpdateScalar: DevString

Commands:

Name Description
QueryInput: DevString
Output: DevVarStringArray
None.
StatusInput: DevVoid
Output: DevString
This command gets the device status (stored in its device_status data member) and returns it to the caller.
StateInput: DevVoid
Output: State
This command gets the device state (stored in its device_state data member) and returns it to the caller.

Pipes:

Properties:

Name Description
UseLocalTimeDevBoolean
PasswordDevString
UserDevString
PortDevString SQLServer port
DBTypeDevString SQLServer or MySQL
DataBaseDevString SQL database
HostDevString SQLServer host


Please log in to comment.

Generated

PDF generated from POGO



README

SQLServer Device Server

Description

Device Server for SQLServer Database Access

Developed at ALBA by Sergi Rubio: http://www.tango-controls.org/Members/srubio This device server requires fandango: http://www.tango-controls.org/Documents/tools/fandango It is based on DynamicAttributes: http://www.tango-controls.org/howtos/dynamicattributes

Usage

To use the device you must initialize the following properties:

Host, Port, DataBase, User, Password

Then, you can use the device directly executing the Query() command:

value1 = PyTango.DeviceProxy('my/sql/server').Query("select TOP 1 value from db.table1 where name in ('value1') order by ts DESC")</pre>

Or create a DynamicAttributes property that read attribute values from the database using the QUERY keyword:

Value1=QUERY("select TOP 1 value from db.table1 where name in ('value1') order by ts DESC")[0][0]

You can define intermediate variables to have shorter syntax or string substitution:

QLAST=str("select TOP 1 value from db.table1 where name in ('%s') order by ts DESC") Value1=QUERY(str(QLAST)%'Value1')[0][0]</pre>

The T_ATTR keyword allows to set both timestamp and value for the attribute from a time,value row:

Value1=DevDouble(T_ATTR(QUERY("select TOP 1 ts,value from db.table1 where name in ('value1') order by ts DESC")[0]))
22 Feb 2018, DS Admin
Updated:
The device class has been updated.
You can see previous version here .



20 Apr 2017, Piotr Goryl
Updated:
The device class has been updated.
You can see previous version here .



23 Feb 2017, Piotr Goryl
Created:
The device class has been added to catalogue.
Added by:pgoryl2 on:23 Feb 2017, 10:54 a.m.