Database API

class tango.Database

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_device(self, dev_info) → None

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_server(self, servname, dev_info, with_dserver=False) → None

Add a (group of) devices to the database. This is considered as a low level call because it may render the database inconsistent if it is not used properly.

If with_dserver parameter is set to False (default), this call will only register the given dev_info(s). You should include in the list of dev_info an entry to the usually hidden DServer device.

If with_dserver parameter is set to True, the call will add an additional DServer device if it is not included in the dev_info parameter.

Example using with_dserver=True:

dev_info1 = DbDevInfo()
dev_info1.name = 'my/own/device'
dev_info1._class = 'MyDevice'
dev_info1.server = 'MyServer/test'
db.add_server(dev_info1.server, dev_info, with_dserver=True)

Same example using with_dserver=False:

dev_info1 = DbDevInfo()
dev_info1.name = 'my/own/device'
dev_info1._class = 'MyDevice'
dev_info1.server = 'MyServer/test'

dev_info2 = DbDevInfo()
dev_info1.name = 'dserver/' + dev_info1.server
dev_info1._class = 'DServer
dev_info1.server = dev_info1.server

dev_info = dev_info1, dev_info2
db.add_server(dev_info1.server, dev_info)

New in version 8.1.7: added with_dserver parameter

Parameters
servname

(str) server name

dev_info

(sequence<DbDevInfo> | DbDevInfos | DbDevInfo) containing the server device(s) information

with_dserver

(bool) whether or not to auto create DServer device in server

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

build_connection(self) → None

Tries to build a connection to the Database server.

Parameters

None

Return

None

New in PyTango 7.0.0

check_access_control(self, dev_name) → AccessControlType

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_tango_host(self, tango_host_env) → None

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

delete_attribute_alias(self, alias) → None

Remove the alias associated to an attribute name.

Parameters
alias

(str) alias

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

delete_class_attribute_property(self, class_name, value) → None

Delete a list of attribute properties for the specified class.

Parameters
class_name

(str) class name

propnames

can be one of the following:

  1. DbData [in] - several property data to be deleted

  2. sequence<str> [in]- several property data to be deleted

  3. sequence<DbDatum> [in] - several property data to be deleted

  4. dict<str, seq<str>> keys are attribute names and value being a list of attribute property names

Return

None

Throws

ConnectionFailed, CommunicationFailed DevFailed from device (DB_SQLError)

delete_class_property(self, class_name, value) → None

Delete a the given of properties for the specified class.

Parameters
class_name

(str) class name

value

can be one of the following:

  1. str [in] - single property data to be deleted

  2. DbDatum [in] - single property data to be deleted

  3. DbData [in] - several property data to be deleted

  4. sequence<str> [in]- several property data to be deleted

  5. sequence<DbDatum> [in] - several property data to be deleted

  6. dict<str, obj> [in] - keys are property names to be deleted (values are ignored)

  7. dict<str, DbDatum> [in] - several DbDatum.name are property names to be deleted (keys are ignored)

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

delete_device(self, dev_name) → None

Delete the device of the specified name from the database.

Parameters
dev_name

(str) device name

Return

None

delete_device_alias(self, alias) → void

Delete a device alias

Parameters
alias

(str) alias name

Return

None

delete_device_attribute_property(self, dev_name, value) → None

Delete a list of attribute properties for the specified device.

Parameters
devname

(string) device name

propnames

can be one of the following: 1. DbData [in] - several property data to be deleted 2. sequence<str> [in]- several property data to be deleted 3. sequence<DbDatum> [in] - several property data to be deleted 3. dict<str, seq<str>> keys are attribute names and value being a list of attribute property names

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

delete_device_property(self, dev_name, value) → None

Delete a the given of properties for the specified device.

Parameters
dev_name

(str) object name

value

can be one of the following: 1. str [in] - single property data to be deleted 2. DbDatum [in] - single property data to be deleted 3. DbData [in] - several property data to be deleted 4. sequence<str> [in]- several property data to be deleted 5. sequence<DbDatum> [in] - several property data to be deleted 6. dict<str, obj> [in] - keys are property names to be deleted (values are ignored) 7. dict<str, DbDatum> [in] - several DbDatum.name are property names to be deleted (keys are ignored)

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

delete_property(self, obj_name, value) → None

Delete a the given of properties for the specified object.

Parameters
obj_name

(str) object name

value

can be one of the following:

  1. str [in] - single property data to be deleted

  2. DbDatum [in] - single property data to be deleted

  3. DbData [in] - several property data to be deleted

  4. sequence<string> [in]- several property data to be deleted

  5. sequence<DbDatum> [in] - several property data to be deleted

  6. dict<str, obj> [in] - keys are property names to be deleted (values are ignored)

  7. dict<str, DbDatum> [in] - several DbDatum.name are property names to be deleted (keys are ignored)

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

delete_server(self, server) → None

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_info(self, server) → 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

export_device(self, dev_export) → None

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_event(self, event_data) → 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_server(self, dev_info) → None

Export a group of devices to the database.

Parameters
devinfo

(sequence<DbDevExportInfo> | DbDevExportInfos | DbDevExportInfo) containing the device(s) to export information

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

get_access_except_errors(self) → DevErrorList

Returns a reference to the control access exceptions.

Parameters

None

Return

DevErrorList

New in PyTango 7.0.0

get_alias(self, alias) → str

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_alias_from_attribute(self, attr_name) → str

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_alias_from_device(self, alias) → str

Get the device alias name from its name.

Parameters
alias

(str) device name

Return

alias

New in PyTango 8.1.0

get_attribute_alias(self, alias) → str

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(self, filter) → DbDatum

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_attribute_from_alias(self, alias) → str

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

get_class_attribute_list(self, class_name, wildcard) → DbDatum

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

get_class_attribute_property(self, class_name, value) → dict<str, dict<str, seq<str>>

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
class_name

(str) class name

propnames

can be one of the following:

  1. str [in] - single attribute properties to be fetched

  2. DbDatum [in] - single attribute properties to be fetched

  3. DbData [in,out] - several attribute properties to be fetched In this case (direct C++ API) the DbData will be filled with the property values

  4. sequence<str> [in] - several attribute properties to be fetched

  5. sequence<DbDatum> [in] - several attribute properties to be fetched

  6. dict<str, obj> [in,out] - keys are attribute names In this case the given dict values will be changed to contain the several attribute property values

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)

get_class_attribute_property_history(self, dev_name, attr_name, prop_name) → DbHistoryList

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

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

get_class_inheritance_for_device(self, dev_name) → DbDatum

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

get_class_list(self, wildcard) → DbDatum

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

get_class_property(self, class_name, value) → dict<str, seq<str>>

Query the database for a list of class properties.

Parameters
class_name

(str) class name

value

can be one of the following:

  1. str [in] - single property data to be fetched

  2. tango.DbDatum [in] - single property data to be fetched

  3. tango.DbData [in,out] - several property data to be fetched In this case (direct C++ API) the DbData will be filled with the property values

  4. sequence<str> [in] - several property data to be fetched

  5. sequence<DbDatum> [in] - several property data to be fetched

  6. dict<str, obj> [in,out] - keys are property names In this case the given dict values will be changed to contain the several property values

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_class_property_history(self, class_name, prop_name) → DbHistoryList

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

get_class_property_list(self, class_name) → DbDatum

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_device_alias(self, alias) → str

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(self, filter) → DbDatum

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

get_device_attribute_property(self, dev_name, value) → dict<str, dict<str, seq<str>>>

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
dev_name

(string) device name

value

can be one of the following:

  1. str [in] - single attribute properties to be fetched

  2. DbDatum [in] - single attribute properties to be fetched

  3. DbData [in,out] - several attribute properties to be fetched In this case (direct C++ API) the DbData will be filled with the property values

  4. sequence<str> [in] - several attribute properties to be fetched

  5. sequence<DbDatum> [in] - several attribute properties to be fetched

  6. dict<str, obj> [in,out] - keys are attribute names In this case the given dict values will be changed to contain the several attribute property values

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_device_attribute_property_history(self, dev_name, att_name, prop_name) → DbHistoryList

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

get_device_class_list(self, server) → DbDatum

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

get_device_domain(self, wildcard) → DbDatum

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

get_device_exported(self, filter) → DbDatum

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

get_device_exported_for_class(self, class_name) → DbDatum

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

get_device_family(self, wildcard) → DbDatum

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_device_from_alias(self, alias) → str

Get the device name from an alias.

Parameters
alias

(str) alias

Return

device name

New in PyTango 8.1.0

get_device_info(self, dev_name) → DbDevFullInfo

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

get_device_member(self, wildcard) → DbDatum

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

get_device_name(self, serv_name, class_name) → DbDatum

Query the database for a list of devices served by a server for a given device class

Parameters
serv_name

(str) server name

class_name

(str) device class name

Return

DbDatum with the list of device names

get_device_property(self, dev_name, value) → dict<str, seq<str>>

Query the database for a list of device properties.

Parameters
dev_name

(str) object name

value

can be one of the following:

  1. str [in] - single property data to be fetched

  2. DbDatum [in] - single property data to be fetched

  3. DbData [in,out] - several property data to be fetched In this case (direct C++ API) the DbData will be filled with the property values

  4. sequence<str> [in] - several property data to be fetched

  5. sequence<DbDatum> [in] - several property data to be fetched

  6. dict<str, obj> [in,out] - keys are property names In this case the given dict values will be changed to contain the several property values

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_device_property_history(self, dev_name, prop_name) → DbHistoryList

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

get_device_property_list(self, dev_name, wildcard, array=None) → DbData

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
dev_name

(str) device name

wildcard

(str) property name wildcard

array

[out] (sequence) (optional) array that will contain the matching property names.

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

get_device_service_list(self, dev_name) → DbDatum

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

get_file_name(self) → str

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) → DbDatum

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

get_host_server_list(self, host_name) → DbDatum

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

get_info(self) → str

Query the database for some general info about the tables.

Parameters

None

Return

a multiline string

get_instance_name_list(self, serv_name) → DbDatum

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

get_object_list(self, wildcard) → DbDatum

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

get_object_property_list(self, obj_name, wildcard) → DbDatum

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

get_property(self, obj_name, value) → dict<str, seq<str>>

Query the database for a list of object (i.e non-device) properties.

Parameters
obj_name

(str) object name

value

can be one of the following:

  1. str [in] - single property data to be fetched

  2. DbDatum [in] - single property data to be fetched

  3. DbData [in,out] - several property data to be fetched In this case (direct C++ API) the DbData will be filled with the property values

  4. sequence<str> [in] - several property data to be fetched

  5. sequence<DbDatum> [in] - several property data to be fetched

  6. dict<str, obj> [in,out] - keys are property names In this case the given dict values will be changed to contain the several property values

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_forced(obj_name, value)

get_property(self, obj_name, value) -> dict<str, seq<str>>

Query the database for a list of object (i.e non-device) properties.

Parameters
obj_name

(str) object name

value

can be one of the following:

  1. str [in] - single property data to be fetched

  2. DbDatum [in] - single property data to be fetched

  3. DbData [in,out] - several property data to be fetched In this case (direct C++ API) the DbData will be filled with the property values

  4. sequence<str> [in] - several property data to be fetched

  5. sequence<DbDatum> [in] - several property data to be fetched

  6. dict<str, obj> [in,out] - keys are property names In this case the given dict values will be changed to contain the several property values

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_history(self, obj_name, prop_name) → DbHistoryList

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

get_server_class_list(self, server) → DbDatum

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

get_server_info(self, server) → DbServerInfo

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) → DbDatum

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 matching servers will be returned (ex: Serial/*)

Parameters
wildcard

(str) host wildcard (ex: Serial/*)

Return

DbDatum containing list of registered servers

get_server_name_list(self) → DbDatum

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

get_services(self, serv_name, inst_name) → DbDatum

Query database for specified services.

Parameters
serv_name

(str) service name

inst_name

(str) instance name (can be a wildcard character (‘*’))

Return

DbDatum with the list of available services

New in PyTango 3.0.4

import_device(self, dev_name) → DbDevImportInfo

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

is_control_access_checked(self) → bool

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

is_multi_tango_host(self) → bool

Returns if in multi tango host.

Parameters

None

Return

True if multi tango host or False otherwise

New in PyTango 7.1.4

put_attribute_alias(self, attr_name, alias) → None

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)

put_class_attribute_property(self, class_name, value) → None

Insert or update a list of properties for the specified class.

Parameters
class_name

(str) class name

propdata

can be one of the following:

  1. tango.DbData - several property data to be inserted

  2. sequence<DbDatum> - several property data to be inserted

  3. dict<str, dict<str, obj>> keys are attribute names and value being another dictionary which keys are the attribute property names and the value associated with each key being:

    3.1 seq<str> 3.2 tango.DbDatum

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

put_class_property(self, class_name, value) → None

Insert or update a list of properties for the specified class.

Parameters
class_name

(str) class name

value

can be one of the following: 1. DbDatum - single property data to be inserted 2. DbData - several property data to be inserted 3. sequence<DbDatum> - several property data to be inserted 4. dict<str, DbDatum> - keys are property names and value has data to be inserted 5. dict<str, obj> - keys are property names and str(obj) is property value 6. dict<str, seq<str>> - keys are property names and value has data to be inserted

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

put_device_alias(self, dev_name, alias) → None

Query database for list of exported devices for the specified class.

Parameters
dev_name

(str) device name

alias

(str) alias name

Return

None

put_device_attribute_property(self, dev_name, value) → None

Insert or update a list of properties for the specified device.

Parameters
dev_name

(str) device name

value

can be one of the following:

  1. DbData - several property data to be inserted

  2. sequence<DbDatum> - several property data to be inserted

  3. dict<str, dict<str, obj>> keys are attribute names and value being another dictionary which keys are the attribute property names and the value associated with each key being:

    3.1 seq<str> 3.2 tango.DbDatum

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

put_device_property(self, dev_name, value) → None

Insert or update a list of properties for the specified device.

Parameters
dev_name

(str) object name

value

can be one of the following:

  1. DbDatum - single property data to be inserted

  2. DbData - several property data to be inserted

  3. sequence<DbDatum> - several property data to be inserted

  4. dict<str, DbDatum> - keys are property names and value has data to be inserted

  5. dict<str, obj> - keys are property names and str(obj) is property value

  6. dict<str, seq<str>> - keys are property names and value has data to be inserted

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

put_property(self, obj_name, value) → None

Insert or update a list of properties for the specified object.

Parameters
obj_name

(str) object name

value

can be one of the following:

  1. DbDatum - single property data to be inserted

  2. DbData - several property data to be inserted

  3. sequence<DbDatum> - several property data to be inserted

  4. dict<str, DbDatum> - keys are property names and value has data to be inserted

  5. dict<str, obj> - keys are property names and str(obj) is property value

  6. dict<str, seq<str>> - keys are property names and value has data to be inserted

Return

None

Throws

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

put_server_info(self, info) → None

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

register_service(self, serv_name, inst_name, dev_name) → None

Register the specified service wihtin the database.

Parameters
serv_name

(str) service name

inst_name

(str) instance name

dev_name

(str) device name

Return

None

New in PyTango 3.0.4

rename_server(self, old_ds_name, new_ds_name) → None

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

reread_filedatabase(self) → None

Force a complete refresh over the database if using a file based database.

Parameters

None

Return

None

New in PyTango 7.0.0

set_access_checked(self, val) → None

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

unexport_device(self, dev_name) → None

Mark the specified device as unexported in the database

Example
db.unexport_device('my/own/device')
Parameters
dev_name

(str) device name

Return

None

unexport_event(self, event) → 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

unexport_server(self, server) → None

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)

unregister_service(self, serv_name, inst_name) → None

Unregister the specified service from the database.

Parameters
serv_name

(str) service name

inst_name

(str) instance name

Return

None

New in PyTango 3.0.4

write_filedatabase(self) → None

Force a write to the file if using a file based database.

Parameters

None

Return

None

New in PyTango 7.0.0

class tango.DbDatum

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.

Note: DbDatum is extended to support the python sequence API.

This way the DbDatum behaves like a sequence of strings. This allows the user to work with a DbDatum as if it was working with the old list of strings.

New in PyTango 7.0.0

is_empty(self) → bool

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

size(self) → int

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

class tango.DbDevExportInfo

import info for a device (should be retrived from the database) with the following members:

  • name : (str) device name

  • ior : (str) CORBA reference of the device

  • host : name of the computer hosting the server

  • version : (str) version

  • pid : process identifier

class tango.DbDevExportInfo

import info for a device (should be retrived from the database) with the following members:

  • name : (str) device name

  • ior : (str) CORBA reference of the device

  • host : name of the computer hosting the server

  • version : (str) version

  • pid : process identifier

class tango.DbDevImportInfo

import info for a device (should be retrived from the database) with the following members:

  • name : (str) device name

  • exported : 1 if device is running, 0 else

  • ior : (str)CORBA reference of the device

  • version : (str) version

class tango.DbDevInfo

A structure containing available information for a device with the following members:

  • name : (str) name

  • _class : (str) device class

  • server : (str) server

class tango.DbHistory

A structure containing the modifications of a property. No public members.

get_attribute_name(self) → str

Returns the attribute name (empty for object properties or device properties)

Parameters

None

Return

(str) attribute name

get_date(self) → str

Returns the update date

Parameters

None

Return

(str) update date

get_name(self) → str

Returns the property name.

Parameters

None

Return

(str) property name

get_value(self) → DbDatum

Returns a COPY of the property value

Parameters

None

Return

(DbDatum) a COPY of the property value

is_deleted(self) → bool

Returns True if the property has been deleted or False otherwise

Parameters

None

Return

(bool) True if the property has been deleted or False otherwise

class tango.DbServerInfo

A structure containing available information for a device server with the following members:

  • name : (str) name

  • host : (str) host

  • mode : (str) mode

  • level : (str) level