Database is the high level Tango object which contains the link to the static database. Database provides methods for all database commands : get_device_property(), put_device_property(), info(), etc.. To create a Database, use the default constructor. Example:
db = Database()
The constructor uses the TANGO_HOST env. variable to determine which instance of the Database to connect to.
Add a device to the database. The device name, server and class are specified in the DbDevInfo structure
Example: dev_info = DbDevInfo() dev_info.name = 'my/own/device' dev_info._class = 'MyDevice' dev_info.server = 'MyServer/test' db.add_device(dev_info)
Parameters:
dev_info: (DbDevInfo) device information Return: None
Add a (group of) devices to the database.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Tries to build a connection to the Database server.
Parameters: None Return: None New in PyTango 7.0.0
Check the access for the given device for this client.
Parameters:
dev_name: (str) device name Return: the access control type as a AccessControlType object
New in PyTango 7.0.0
Check the TANGO_HOST environment variable syntax and extract database server host(s) and port(s) from it.
Parameters:
tango_host_env: (str) The TANGO_HOST env. variable value Return: None
New in PyTango 7.0.0
Remove the alias associated to an attribute name.
Parameters:
alias: (str) alias Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
Delete a list of attribute properties for the specified class.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed DevFailed from device (DB_SQLError) |
Delete a the given of properties for the specified class.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Delete the device of the specified name from the database.
Parameters:
dev_name: (str) device name Return: None
Delete a device alias
Parameters:
alias: (str) alias name Return: None
Delete a list of attribute properties for the specified device.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Delete a the given of properties for the specified device.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Delete a the given of properties for the specified object.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Delete the device server and its associated devices from database.
Parameters:
server: (str) name of the server to be deleted with format: <server name>/<instance> Return: None
Delete server information of the specifed server from the database.
Parameters:
server: (str) name of the server to be deleted with format: <server name>/<instance> Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 3.0.4
Update the export info for this device in the database.
Example: dev_export = DbDevExportInfo() dev_export.name = 'my/own/device' dev_export.ior = <the real ior> dev_export.host = <the host> dev_export.version = '3.0' dev_export.pid = '....' db.export_device(dev_export)
Parameters:
dev_export: (DbDevExportInfo) export information Return: None
Export an event to the database.
Parameters:
eventdata: (sequence<str>) event data (same as DbExportEvent Database command) Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Export a group of devices to the database.
Parameters : |
|
||
---|---|---|---|
Return : | None |
||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Returns a reference to the control access exceptions.
Parameters: None Return: DevErrorList New in PyTango 7.0.0
Get the device alias name from its name.
Parameters:
alias: (str) device name Return: alias
New in PyTango 3.0.4
Deprecated since version 8.1.0: Use get_alias_from_device() instead
Get the attribute alias from the full attribute name.
Parameters:
attr_name: (str) full attribute name Return: attribute alias
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 8.1.0
Get the device alias name from its name.
Parameters:
alias: (str) device name Return: alias
New in PyTango 8.1.0
Get the full attribute name from an alias.
Parameters:
alias: (str) attribute alias Return: full attribute name
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
Deprecated since version 8.1.0: Use :class:`Database().get_attribute_from_alias` instead
Get attribute alias list. The parameter alias is a string to filter the alias list returned. Wildcard (*) is supported. For instance, if the string alias passed as the method parameter is initialised with only the * character, all the defined attribute alias will be returned. If there is no alias with the given filter, the returned array will have a 0 size.
Parameters:
filter: (str) attribute alias filter Return: DbDatum containing the list of matching attribute alias
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
Get the full attribute name from an alias.
Parameters:
alias: (str) attribute alias Return: full attribute name
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 8.1.0
Query the database for a list of attributes defined for the specified class which match the specified wildcard.
Parameters:
class_name: (str) class name wildcard: (str) attribute name Return: DbDatum containing the list of matching attributes for the given class
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of class attribute properties for the specified class. The method returns all the properties for the specified attributes.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | a dictionary which keys are the attribute names the value associated with each key being a another dictionary where keys are property names and value is a sequence of strings being the property value. |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Delete a list of properties for the specified class. This corresponds to the pure C++ API call.
Parameters:
dev_name: (str) device name attr_name: (str) attribute name prop_name: (str) property name Return: DbHistoryList containing the list of modifications
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Return the class of the specified device.
Parameters:
dev_name: (str) device name Return: a string containing the device class
get_class_for_device (self, dev_name) -> str
Return the class of the specified device.
Parameters:
dev_name: (str) device name Return: a string containing the device class
Return the class inheritance scheme of the specified device.
Parameters:
devn_ame: (str) device name Return: DbDatum with the inheritance class list
New in PyTango 7.0.0
Query the database for a list of classes which match the specified wildcard
Parameters:
wildcard: (str) class wildcard Return: DbDatum containing the list of matching classes
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of class properties.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | a dictionary which keys are the property names the value associated with each key being a a sequence of strings being the property value. |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Get the list of the last 10 modifications of the specified class property. Note that propname can contain a wildcard character (eg: ‘prop*’).
Parameters:
class_name: (str) class name prop_name: (str) property name Return: DbHistoryList containing the list of modifications
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of properties defined for the specified class.
Parameters:
class_name: (str) class name Return: DbDatum containing the list of properties for the specified class
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
Get the device name from an alias.
Parameters:
alias: (str) alias Return: device name
Deprecated since version 8.1.0: Use get_device_from_alias() instead
Get device alias list. The parameter alias is a string to filter the alias list returned. Wildcard (*) is supported.
Parameters:
filter: (str) a string with the alias filter (wildcard (*) is supported) Return: DbDatum with the list of device names
New in PyTango 7.0.0
Query the database for a list of device attribute properties for the specified device. The method returns all the properties for the specified attributes.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | a dictionary which keys are the attribute names the value associated with each key being a another dictionary where keys are property names and value is a DbDatum containing the property value. |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Get the list of the last 10 modifications of the specified device attribute property. Note that propname and devname can contain a wildcard character (eg: ‘prop*’).
Parameters:
dev_name: (str) device name attn_ame: (str) attribute name prop_name: (str) property name Return: DbHistoryList containing the list of modifications
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of devices and classes served by the specified server. Return a list with the following structure: [device name, class name, device name, class name, ...]
Parameters:
server: (str) name of the server with format: <server name>/<instance> Return: DbDatum containing list with the following structure: [device_name, class name]
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 3.0.4
Query the database for a list of of device domain names which match the wildcard provided (* is wildcard for any character(s)). Domain names are case insensitive.
Parameters:
wildcard: (str) domain filter Return: DbDatum with the list of device domain names
Query the database for a list of exported devices whose names satisfy the supplied filter (* is wildcard for any character(s))
Parameters:
filter: (str) device name filter (wildcard) Return: DbDatum with the list of exported devices
Query database for list of exported devices for the specified class.
Parameters:
class_name: (str) class name Return: DbDatum with the list of exported devices for the
New in PyTango 7.0.0
Query the database for a list of of device family names which match the wildcard provided (* is wildcard for any character(s)). Family names are case insensitive.
Parameters:
wildcard: (str) family filter Return: DbDatum with the list of device family names
Get the device name from an alias.
Parameters:
alias: (str) alias Return: device name
New in PyTango 8.1.0
Query the databse for the full info of the specified device.
Example: dev_info = db.get_device_info('my/own/device') print(dev_info.name) print(dev_info.class_name) print(dev_info.ds_full_name) print(dev_info.exported) print(dev_info.ior) print(dev_info.version) print(dev_info.pid) print(dev_info.started_date) print(dev_info.stopped_date)
Parameters:
dev_name: (str) device name Return: DbDevFullInfo
New in PyTango 8.1.0
Query the database for a list of of device member names which match the wildcard provided (* is wildcard for any character(s)). Member names are case insensitive.
Parameters:
wildcard: (str) member filter Return: DbDatum with the list of device member names
Query the database for a list of device properties.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | a dictionary which keys are the property names the value associated with each key being a a sequence of strings being the property value. |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Get the list of the last 10 modifications of the specified device property. Note that propname can contain a wildcard character (eg: ‘prop*’). This corresponds to the pure C++ API call.
Parameters:
serv_name: (str) server name prop_name: (str) property name Return: DbHistoryList containing the list of modifications
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of properties defined for the specified device and which match the specified wildcard. If array parameter is given, it must be an object implementing de ‘append’ method. If given, it is filled with the matching property names. If not given the method returns a new DbDatum containing the matching property names.
New in PyTango 7.0.0
Parameters : |
|
||||||
---|---|---|---|---|---|---|---|
Return : | if container is None, return is a new DbDatum containing the matching property names. Otherwise returns the given array filled with the property names |
||||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device |
Query database for the list of services provided by the given device.
Parameters:
dev_name: (str) device name Return: DbDatum with the list of services
New in PyTango 8.1.0
Returns the database file name or throws an exception if not using a file database
Parameters: None Return: a string containing the database file name Throws: DevFailed New in PyTango 7.2.0
get_host_list (self, wildcard) -> DbDatum
Returns the list of all host names registered in the database.
Parameters:
wildcard: (str) (optional) wildcard (eg: ‘l-c0*’) Return: DbDatum with the list of registered host names
Query the database for a list of servers registred on the specified host.
Parameters:
host_name: (str) host name Return: DbDatum containing list of servers for the specified host
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 3.0.4
Query the database for some general info about the tables.
Parameters: None Return: a multiline string
Return the list of all instance names existing in the database for the specifed server.
Parameters:
serv_name: (str) server name with format <server name> Return: DbDatum containing list of instance names for the specified server
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 3.0.4
Query the database for a list of object (free properties) for which properties are defined and which match the specified wildcard.
Parameters:
wildcard: (str) object wildcard Return: DbDatum containing the list of object names matching the given wildcard
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of properties defined for the specified object and which match the specified wildcard.
Parameters:
obj_name: (str) object name wildcard: (str) property name wildcard Return: DbDatum with list of properties defined for the specified object and which match the specified wildcard
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of object (i.e non-device) properties.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | a dictionary which keys are the property names the value associated with each key being a a sequence of strings being the property value. |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
get_property(self, obj_name, value) -> dict<str, seq<str>>
Query the database for a list of object (i.e non-device) properties.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | a dictionary which keys are the property names the value associated with each key being a a sequence of strings being the property value. |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Get the list of the last 10 modifications of the specifed object property. Note that propname can contain a wildcard character (eg: ‘prop*’)
Parameters:
serv_name: (str) server name prop_name: (str) property name Return: DbHistoryList containing the list of modifications
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Query the database for a list of classes instancied by the specified server. The DServer class exists in all TANGO servers and for this reason this class is removed from the returned list.
Parameters:
server: (str) name of the server to be deleted with format: <server name>/<instance> Return: DbDatum containing list of class names instanciated by the specified server
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 3.0.4
Query the database for server information.
Parameters:
server: (str) name of the server to be unexported with format: <server name>/<instance> Return: DbServerInfo with server information
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 3.0.4
get_server_list (self, wildcard) -> DbDatum
Return the list of all servers registered in the database. If wildcard parameter is given, then the the list of servers registred on the specified host (we refer ‘host’ in the context of tango device, i.e. following the tango naming convention ‘host/family/member’) is returned
Parameters:
wildcard: (str) host wildcard Return: DbDatum containing list of registered servers
Return the list of all server names registered in the database.
Parameters: None Return: DbDatum containing list of server names Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) New in PyTango 3.0.4
Query the databse for the export info of the specified device.
Example: dev_imp_info = db.import_device('my/own/device') print(dev_imp_info.name) print(dev_imp_info.exported) print(dev_imp_info.ior) print(dev_imp_info.version)
Parameters:
dev_name: (str) device name Return: DbDevImportInfo
Returns True if control access is checked or False otherwise.
Parameters: None Return: (bool) True if control access is checked or False New in PyTango 7.0.0
Returns if in multi tango host.
Parameters: None Return: True if multi tango host or False otherwise New in PyTango 7.1.4
Set an alias for an attribute name. The attribute alias is specified by aliasname and the attribute name is specifed by attname. If the given alias already exists, a DevFailed exception is thrown.
Parameters:
attr_name: (str) full attribute name alias: (str) alias Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
Insert or update a list of properties for the specified class.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Insert or update a list of properties for the specified class.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Insert or update a list of properties for the specified device.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Insert or update a list of properties for the specified device.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Insert or update a list of properties for the specified object.
Parameters : |
|
||||
---|---|---|---|---|---|
Return : | None |
||||
Throws : | ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError) |
Add/update server information in the database.
Parameters:
info: (DbServerInfo) new server information Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 3.0.4
Rename a device server process.
Parameters:
old_ds_name: (str) old name new_ds_name: (str) new name Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 8.1.0
Force a complete refresh over the database if using a file based database.
Parameters: None Return: None New in PyTango 7.0.0
Sets or unsets the control access check.
Parameters:
val: (bool) True to set or False to unset the access control Return: None
New in PyTango 7.0.0
Mark the specified device as unexported in the database
Example: db.unexport_device('my/own/device')
Parameters:
dev_name: (str) device name Return: None
Un-export an event from the database.
Parameters:
event: (str) event Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
New in PyTango 7.0.0
Mark all devices exported for this server as unexported.
Parameters:
server: (str) name of the server to be unexported with format: <server name>/<instance> Return: None
Throws: ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)
Force a write to the file if using a file based database.
Parameters: None Return: None New in PyTango 7.0.0
A single database value which has a name, type, address and value and methods for inserting and extracting C++ native types. This is the fundamental type for specifying database properties. Every property has a name and has one or more values associated with it. A status flag indicates if there is data in the DbDatum object or not. An additional flag allows the user to activate exceptions.
New in PyTango 7.0.0
Returns True or False depending on whether the DbDatum object contains data or not. It can be used to test whether a property is defined in the database or not.
Parameters: None Return: (bool) True if no data or False otherwise. New in PyTango 7.0.0
Returns the number of separate elements in the value.
Parameters: None Return: the number of separate elements in the value. New in PyTango 7.0.0
import info for a device (should be retrived from the database) with the following members:
import info for a device (should be retrived from the database) with the following members:
import info for a device (should be retrived from the database) with the following members:
A structure containing available information for a device with the following members:
A structure containing the modifications of a property. No public members.
Returns the attribute name (empty for object properties or device properties)
Parameters: None Return: (str) attribute name
A structure containing available information for a device server with the following members: