Database API

Contents

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.

If TANGO_HOST env is not set, or you want to connect to a specific database, you can provide host and port to constructor:

db = Database(host: str, port: int)

or:

db = Database(host: str, port: str)

Alternatively, it is possible to start Database using file instead of a real database:

db = Database(filename: str)

add_device(self: tango._tango.Database, dev_info: tango._tango.DbDevInfo) 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

add_server(servname, dev_info, with_dserver=False)#

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_info1, 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_info2.name = 'dserver/' + dev_info1.server
dev_info2._class = 'DServer
dev_info2.server = dev_info1.server

dev_info = dev_info1, dev_info2
db.add_server(dev_info1.server, dev_info)
Parameters:
  • servname (str) – server name

  • dev_info (list[DbDevInfo], DbDevInfos, DbDevInfo) – the server device(s) information

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

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

Added in version 8.1.7: added with_dserver parameter

build_connection(self: tango._tango.Database) None#

Tries to build a connection to the Database server.

Added in version 7.0.0.

check_access_control(self: tango._tango.Database, dev_name: str) tango._tango.AccessControlType#

check_access_control (self, dev_name) -> AccessControlType

Check the access for the given device for this client.

Parameters:

dev_name – device name

Returns:

the access control type as a AccessControlType object

Added in version 7.0.0.

check_tango_host(self: tango._tango.Database, tango_host_env: str) None#

Check the TANGO_HOST environment variable syntax and extract database server host(s) and port(s) from it.

Parameters:

tango_host_env – The TANGO_HOST env. variable value

Added in version 7.0.0.

delete_attribute_alias(self: tango._tango.Database, alias: str) None#

Remove the alias associated to an attribute name.

Parameters:

alias (str)

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

delete_class_attribute_property(class_name: str, value: DbDatum | list[str] | list[DbDatum] | dict[str, list[str]]) None#

Delete a list of attribute properties for the specified class.

Parameters:
  • class_name (str) – class name

  • value

    can be one of the following:

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

    2. list[str] [in]- several property data to be deleted

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

    4. dict[str, list[str]] keys are attribute names and value being a list of attribute property names

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

delete_class_property(class_name: str, value: str | DbDatum | DbData | list[str] | list[DbDatum] | dict[str, object] | dict[str, DbDatum]) None#

Delete the given properties for the specified class.

Parameters:
  • class_name (str) – class name

  • value

    can be one of the following:

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

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

    3. DbData [in,out] - several attribute properties to be deleted

    4. list[str] [in] - several attribute properties to be deleted

    5. list[DbDatum] [in] - several attribute properties to be deleted

    6. dict[str, object] [in,out] - 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)

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

delete_device(self: tango._tango.Database, dev_name: str) None#

Delete the device of the specified name from the database.

Parameters:

dev_name (str) – device name

delete_device_alias(self: tango._tango.Database, alias: str) None#

Delete a device alias

Parameters:

alias (str) – alias name

delete_device_attribute_property(dev_name: str, value: DbDatum | list[str] | list[DbDatum] | dict[str, list[str]]) None#

Delete a list of attribute properties for the specified device.

Parameters:
  • dev_name (str) – device name

  • value

    can be one of the following:

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

    2. list[str] [in] - several property data to be deleted

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

    4. dict[str, list[str]] - with each key a attribute name and the value a list of pipe property names to delete from that pipe

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

delete_device_property(dev_name: str, value) None#

Delete the given 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. list[str] [in]- several property data to be deleted

    5. list[DbDatum] [in] - several property data to be deleted

    6. dict[str, object] [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)

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

delete_property(obj_name: str, value: str | DbDatum | DbData | list[str] | list[DbDatum] | dict[str, object] | dict[str, DbDatum]) None#

Delete the given properties for the specified object.

Parameters:
  • obj_name (str) – name of the object

  • value

    the server device(s) information:

    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. list[str] [in]- several property data to be deleted

    5. list[DbDatum] [in] - several property data to be deleted

    6. dict[str, object] [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)

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

delete_server(self: tango._tango.Database, server: str) 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>

delete_server_info(self: tango._tango.Database, server: str) None#

Delete server information of the specified server from the database.

Parameters:

server (DbServerInfo) – name of the server to be deleted with format: <server name>/<instance>

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

dev_name(self: tango._tango.Database) str#
export_device(self: tango._tango.Database, dev_export: tango._tango.DbDevExportInfo) 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) – dexport information

export_event(self: tango._tango.Database, event_data: list[str]) None#

Export an event to the database.

Parameters:

event_data – event data (same as DbExportEvent Database command)

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

export_server(dev_info: Sequence[DbDevExportInfo] | DbDevExportInfos | DbDevExportInfo)#

Export a group of devices to the database.

Parameters:

dev_info – the server device(s) information

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

get_access_except_errors(self: tango._tango.Database) list[DevError]#

Returns a reference to the control access exceptions.

Added in version 7.0.0.

get_alias(self: tango._tango.Database, dev_name: str) str#

Get the device alias name from its name.

Parameters:

dev_name (str)

Added in version 3.0.4.

Deprecated since version 8.1.0: Use get_alias_from_device() instead

get_alias_from_attribute(self: tango._tango.Database, attr_name: str) str#

Get the attribute alias from the full attribute name.

Parameters:

attr_name (str) – full attribute name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 8.1.0.

get_alias_from_device(self: tango._tango.Database, dev_name: str) str#

Get the device alias name from its name.

Parameters:

dev_name (str) – device name

Added in version 8.1.0.

get_attribute_alias(self: tango._tango.Database, alias: str) str#

Get the full attribute name from an alias.

Parameters:

alias (str) – attribute alias

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Deprecated since version 8.1.0: Use get_attribute_from_alias() instead

get_attribute_alias_list(self: tango._tango.Database, filter: str) tango._tango.DbDatum#

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

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

get_attribute_from_alias(self: tango._tango.Database, alias: str) str#

Get the full attribute name from an alias.

Parameters:

alias (str) – attribute alias

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 8.1.0.

get_class_attribute_list(self: tango._tango.Database, class_name: str, wildcard: str) tango._tango.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

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_class_attribute_property(class_name: str, value: str | DbDatum | DbData | list[str] | list[DbDatum] | dict[str, object]) dict[str, dict[str, list[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

  • 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. list[str] [in] - several attribute properties to be fetched

    5. list[DbDatum] [in] - several attribute properties to be fetched

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

Returns:

a dictionary keyed by the attribute name, with the associated value another dictionary. The inner dictionary is keyed by attribute property name, with the associated value a sequence of strings representing the property value.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

get_class_attribute_property_history(self: tango._tango.Database, class_name: str, attr_name: str, prop_name: str) tango._tango.DbHistoryList#

Get the list of the last 10 modifications of the specifed class attribute property. Note that prop_name and attr_name can contain a wildcard character (eg: ‘prop*’).

Parameters:
  • class_name (str) – class name

  • attr_name (str) – attribute name

  • prop_name (str) – property name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_class_for_device(self: tango._tango.Database, dev_name: str) str#

Return the class of the specified device.

Parameters:

dev_name (str)

get_class_inheritance_for_device(self: tango._tango.Database, dev_name: str) tango._tango.DbDatum#

Return the class inheritance scheme of the specified device.

Parameters:

dev_name (str)

Added in version 7.0.0.

get_class_list(self: tango._tango.Database, wildcard: str) tango._tango.DbDatum#

Query the database for a list of classes which match the specified wildcard

Parameters:

wildcard (str) – class wildcard

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_class_property(class_name: str, value: str | DbDatum | DbData | list[str] | list[DbDatum] | dict[str, object]) dict[str, list[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. 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. list[str] [in] - several property data to be fetched

    5. list[DbDatum] [in] - several property data to be fetched

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

Returns:

a dictionary keyed by the property name, with the associated value a sequence of strings representing the property value.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

get_class_property_history(self: tango._tango.Database, class_name: str, prop_name: str) tango._tango.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

Returns:

the list of modifications

Return type:

DbHistoryList

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_class_property_list(self: tango._tango.Database, class_name: str) tango._tango.DbDatum#

Query the database for a list of properties defined for the specified class.

Parameters:

class_name (str) – class name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

get_device_alias(self: tango._tango.Database, alias: str) str#

Get the device name from an alias.

Parameters:

alias (str)

Deprecated since version 8.1.0: Use get_device_from_alias() instead

get_device_alias_list(self: tango._tango.Database, filter: str) tango._tango.DbDatum#

Get device alias list. The parameter alias is a string to filter the alias list returned. Wildcard (*) is supported.

Parameters:

wildcard (str) – a string with the alias filter (wildcard (*) is supported)

Added in version 7.0.0.

get_device_attribute_list(self: tango._tango.Database, dev_name: str, att_list: tango._tango.StdStringVector) None#

Get the list of attribute(s) with some data defined in database for a specified device. Note that this is not the list of all device attributes because not all attribute(s) have some data in database This corresponds to the pure C++ API call.

Parameters:
  • dev_name (str) – device name

  • att_list (list[str]) – array that will contain the attribute name list

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

get_device_attribute_property(dev_name: str, value: str | DbDatum | DbData | list[str] | list[DbDatum] | dict[str, object]) dict[str, dict[str, list[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 (str) – 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. list[str] [in] - several attribute properties to be fetched

    5. list[DbDatum] [in] - several attribute properties to be fetched

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

Returns:

a dictionary keyed by the attribute name, with the associated value another dictionary. The inner dictionary is keyed by attribute property name, with the associated value a sequence of strings representing the property value.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

get_device_attribute_property_history(self: tango._tango.Database, dev_name: str, attr_name: str, prop_name: str) tango._tango.DbHistoryList#

get_device_attribute_property_history (self, dev_name, attr_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

  • attr_name (str) – attribute name

  • prop_name (str) – property name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_device_class_list(self: tango._tango.Database, server: str) tango._tango.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>

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

get_device_domain(self: tango._tango.Database, wildcard: str) tango._tango.DbDatum#

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

get_device_exported(self: tango._tango.Database, filter: str) tango._tango.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)

get_device_exported_for_class(self: tango._tango.Database, class_name: str) tango._tango.DbDatum#

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

Parameters:

class_name (str) – class name

Added in version 7.0.0.

get_device_family(self: tango._tango.Database, wildcard: str) tango._tango.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

get_device_from_alias(self: tango._tango.Database, alias: str) str#

Get the device name from an alias.

Parameters:

alias (str)

Added in version 8.1.0.

get_device_info(self: tango._tango.Database, dev_name: str) tango._tango.DbDevFullInfo#

Query the database 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.host)
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

Added in version 8.1.0.

Changed in version 10.1.0: Added host field to DbDevFullInfo

get_device_member(self: tango._tango.Database, wildcard: str) tango._tango.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

get_device_name(self: tango._tango.Database, serv_name: str, class_name: str) tango._tango.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

get_device_property(dev_name: str, value: str | DbDatum | DbData | list[str] | list[DbDatum] | dict[str, object]) dict[str, list[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. list[str] [in] - several property data to be fetched

    5. list[DbDatum] [in] - several property data to be fetched

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

Returns:

a dictionary keyed by the property name, with the associated value a sequence of strings representing the property value.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

get_device_property_history(self: tango._tango.Database, dev_name: str, prop_name: str) tango._tango.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:
  • dev_name (str) – server name

  • prop_name (str) – property name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_device_property_list(dev_name: str, wildcard: str, array: list[object] | None = None) DbDatum | None | list[object]#

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.

Parameters:
  • dev_name (str) – device name

  • wildcard (str) – property name wildcard

  • array (list[]) – (optional) array that will contain the matching property names.

Returns:

if container is None, return is a new DbDatum containing the matching property names. Otherwise returns the given array filled with the property names

Return type:

DbDatum | list[]

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

Added in version 7.0.0.

get_device_service_list(self: tango._tango.Database, dev_name: str) tango._tango.DbDatum#

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

Returns:

the list of services

Added in version 8.1.0.

get_file_name(self: tango._tango.Database) str#

Returns the database file name or throws an exception if not using a file database

Throws:

DevFailed

Added in version 7.2.0.

get_host_list(*args, **kwargs)#

Overloaded function.

  1. get_host_list(self: tango._tango.Database) -> tango._tango.DbDatum

Returns the list of all host names registered in the database.

  1. get_host_list(self: tango._tango.Database, wildcard: str) -> tango._tango.DbDatum

Returns the list of all host names registered in the database.

Parameters:

wildcard (str) – wildcard (eg: ‘l-c0*’)

get_host_server_list(self: tango._tango.Database, host_name: str) tango._tango.DbDatum#

Query the database for a list of servers registered on the specified host.

Parameters:

host_name (str) – host name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

get_info(self: tango._tango.Database) str#

get_info (self) -> str

Query the database for some general info about the tables.

Returns:

a multiline string

get_instance_name_list(self: tango._tango.Database, serv_name: str) tango._tango.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>

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

get_object_list(self: tango._tango.Database, wildcard: str) tango._tango.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

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_object_property_list(self: tango._tango.Database, obj_name: str, wildcard: str) tango._tango.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

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_property(obj_name: str, value: str | DbDatum | DbData | Sequence[str] | Sequence[DbDatum] | dict[str, object]) dict[str, list[str]]#

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

Parameters:
  • obj_name (str) – name of the object

  • value – the server device(s) information

  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. list[str] [in] - several property data to be fetched

  5. list[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

Returns:

a dictionary keyed by the property name, with the associated value a sequence of strings representing the property value.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

get_property_forced(obj_name, value)#

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

Parameters:
  • obj_name (str) – name of the object

  • value – the server device(s) information

  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. list[str] [in] - several property data to be fetched

  5. list[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

Returns:

a dictionary keyed by the property name, with the associated value a sequence of strings representing the property value.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

get_property_history(self: tango._tango.Database, obj_name: str, props: str) tango._tango.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:
  • obj_name (str) – object name

  • prop_name (str) – property name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

get_server_class_list(self: tango._tango.Database, server: str) tango._tango.DbDatum#

Query the database for a list of classes instantiated 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. Format: <server name>/<instance>

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

get_server_info(self: tango._tango.Database, server: str) tango._tango.DbServerInfo#

Query the database for server information.

Parameters:

server (str) – name of the server with format: <server name>/<instance>

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

get_server_list(*args, **kwargs)#

Overloaded function.

  1. get_server_list(self: tango._tango.Database) -> tango._tango.DbDatum

Return the list of all servers registered in the database.

  1. get_server_list(self: tango._tango.Database, wildcard: str) -> tango._tango.DbDatum

get_server_list (self, wildcard) -> DbDatum

Return the list of of matching servers will be returned (ex: Serial/\*)

Parameters:

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

get_server_name_list(self: tango._tango.Database) tango._tango.DbDatum#

Return the list of all server names registered in the database.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

get_server_release(self: tango._tango.Database) int#

Returns the server version

get_services(self: tango._tango.Database, serv_name: str, inst_name: str) tango._tango.DbDatum#

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 (‘*’))

Returns:

the list of available services

Added in version 3.0.4.

import_device(self: tango._tango.Database, dev_name: str) tango._tango.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

is_control_access_checked(self: tango._tango.Database) bool#

Returns True if control access is checked or False otherwise.

Added in version 7.0.0.

is_multi_tango_host(self: tango._tango.Database) bool#

Returns if in multi tango host.

Added in version 7.1.4.

put_attribute_alias(self: tango._tango.Database, attr_name: str, alias: str) None#

put_attribute_alias (self, attr_name, alias) -> None

Set an alias for an attribute name. The attribute alias is specified by alias and the attribute name is specifed by attr_name. If the given alias already exists, a DevFailed exception is thrown.

Parameters:
  • attr_name (str) – full attribute name

  • alias (str)

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

put_class_attribute_property(class_name: str, value: DbData | list[DbDatum] | dict[str, DbDatum]) 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. DbData - several property data to be inserted

    2. list[DbDatum] - several property data to be inserted

    3. dict[str, dict[str, DbDatum]] keys are attribute names and value being another dictionary which keys are the attribute property names and the value

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

put_class_property(class_name: str, value: DbDatum | DbData | list[DbDatum] | dict[str, DbDatum] | dict[str, object] | dict[str, list[str]]) 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 [in] - single attribute properties to be inserted

    2. DbData [in,out] - several attribute properties to be inserted

    3. list`[:obj:`~tango.DbDatum] [in] - several attribute properties to be inserted

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

    5. dict[str, object] - keys are property names and str(obj) is property value

    6. dict[str, list[str]] - keys are property names and value has data to be inserted

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

put_device_alias(self: tango._tango.Database, dev_name: str, alias: str) None#

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

Parameters:
  • dev_name (str) – device name

  • alias (str) – alias name

put_device_attribute_property(dev_name: str, value: DbData | list[DbDatum] | dict[str, dict[str, DbDatum]]) 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 [in,out] - several property data to be inserted

    2. list[DbDatum] [in] - several property data to be inserted

    3. dict[str, dict[str, DbDatum]] - keys are attribute names and value another dictionary where keys are the attribute property names and the values are DbDatum.

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

put_device_property(dev_name: str, value: DbDatum | DbData | list[DbDatum] | dict[str, DbDatum] | dict[str, object] | dict[str, list[str]]) 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. list[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, object] - keys are property names and str(obj) is property value

    6. dict[str, list`[:py:obj:`str]] - keys are property names and value has data to be inserted

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

put_property(obj_name: str, value: DbDatum | DbData | Sequence[DbDatum] | dict[str, DbDatum] | dict[str, Sequence[str]] | dict[str, object]) None#

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

Parameters:
  • obj_name (str) – name of the object

  • value

    Can be one of the following:

    1. DbDatum - single property data to be inserted

    2. DbData - several property data to be inserted

    3. list[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, list[str]] - keys are property names and value has data to be inserted

    6. dict[str, obj] - keys are property names and str(obj) is property value

Throws:

ConnectionFailed, CommunicationFailed, DevFailed

put_server_info(self: tango._tango.Database, info: tango._tango.DbServerInfo) None#

Add/update server information in the database.

Parameters:

info (DbServerInfo) – new server information

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 3.0.4.

register_service(self: tango._tango.Database, serv_name: str, inst_name: str, dev_name: str) None#

Register the specified service wihtin the database.

Parameters:
  • serv_name (str) – service name

  • inst_name (str) – instance name

  • dev_name (str) – device name

Added in version 3.0.4.

rename_server(self: tango._tango.Database, old_ds_name: str, new_ds_name: str) None#

Rename a device server process.

Parameters:
  • old_ds_name (str) – old name

  • new_ds_name (str) – new name

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 8.1.0.

reread_filedatabase(self: tango._tango.Database) None#

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

Added in version 7.0.0.

set_access_checked(self: tango._tango.Database, val: bool) None#

Sets or unsets the control access check.

Parameters:

val – True to set or False to unset the access control

Added in version 7.0.0.

unexport_device(self: tango._tango.Database, dev_name: str) None#

Mark the specified device as unexported in the database

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

dev_name (str) – device name

unexport_event(self: tango._tango.Database, event: str) None#

Un-export an event from the database.

Parameters:

event (str)

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

Added in version 7.0.0.

unexport_server(self: tango._tango.Database, server: str) 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>

Throws:

ConnectionFailed, CommunicationFailed, DevFailed from device (DB_SQLError)

unregister_service(self: tango._tango.Database, serv_name: str, inst_name: str) None#

Unregister the specified service from the database.

Parameters:
  • serv_name (str) – service name

  • inst_name (str) – instance name

Added in version 3.0.4.

write_filedatabase(self: tango._tango.Database) None#

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

Added in version 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.

Added in version 7.0.0.

is_empty(self: tango._tango.DbDatum) 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.

Added in version 7.0.0.

size(self: tango._tango.DbDatum) int#

Returns the number of separate elements in the value.

Added in version 7.0.0.

class tango.DbDevExportInfo#

A structure containing export info for a device (should be retrieved 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.DbDevExportInfos#
append(self: tango._tango.DbDevExportInfos, x: tango._tango.DbDevExportInfo) None#

Add an item to the end of the list

clear(self: tango._tango.DbDevExportInfos) None#

Clear the contents

count(self: tango._tango.DbDevExportInfos, x: tango._tango.DbDevExportInfo) int#

Return the number of times x appears in the list

extend(*args, **kwargs)#

Overloaded function.

  1. extend(self: tango._tango.DbDevExportInfos, L: tango._tango.DbDevExportInfos) -> None

Extend the list by appending all the items in the given list

  1. extend(self: tango._tango.DbDevExportInfos, L: collections.abc.Iterable) -> None

Extend the list by appending all the items in the given list

insert(self: tango._tango.DbDevExportInfos, i: SupportsInt | SupportsIndex, x: tango._tango.DbDevExportInfo) None#

Insert an item at a given position.

pop(*args, **kwargs)#

Overloaded function.

  1. pop(self: tango._tango.DbDevExportInfos) -> tango._tango.DbDevExportInfo

Remove and return the last item

  1. pop(self: tango._tango.DbDevExportInfos, i: typing.SupportsInt | typing.SupportsIndex) -> tango._tango.DbDevExportInfo

Remove and return the item at index i

remove(self: tango._tango.DbDevExportInfos, x: tango._tango.DbDevExportInfo) None#

Remove the first item from the list whose value is x. It is an error if there is no such item.

class tango.DbDevImportInfo#

A structure containing import info for a device (should be retrieved 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.DbDevImportInfos#
append(self: tango._tango.DbDevImportInfos, x: tango._tango.DbDevImportInfo) None#

Add an item to the end of the list

clear(self: tango._tango.DbDevImportInfos) None#

Clear the contents

count(self: tango._tango.DbDevImportInfos, x: tango._tango.DbDevImportInfo) int#

Return the number of times x appears in the list

extend(*args, **kwargs)#

Overloaded function.

  1. extend(self: tango._tango.DbDevImportInfos, L: tango._tango.DbDevImportInfos) -> None

Extend the list by appending all the items in the given list

  1. extend(self: tango._tango.DbDevImportInfos, L: collections.abc.Iterable) -> None

Extend the list by appending all the items in the given list

insert(self: tango._tango.DbDevImportInfos, i: SupportsInt | SupportsIndex, x: tango._tango.DbDevImportInfo) None#

Insert an item at a given position.

pop(*args, **kwargs)#

Overloaded function.

  1. pop(self: tango._tango.DbDevImportInfos) -> tango._tango.DbDevImportInfo

Remove and return the last item

  1. pop(self: tango._tango.DbDevImportInfos, i: typing.SupportsInt | typing.SupportsIndex) -> tango._tango.DbDevImportInfo

Remove and return the item at index i

remove(self: tango._tango.DbDevImportInfos, x: tango._tango.DbDevImportInfo) None#

Remove the first item from the list whose value is x. It is an error if there is no such item.

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: tango._tango.DbHistory) str#

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

get_date(self: tango._tango.DbHistory) str#

Returns the update date

get_name(self: tango._tango.DbHistory) str#

Returns the property name.

get_value(self: tango._tango.DbHistory) tango._tango.DbDatum#

Returns the property value

is_deleted(self: tango._tango.DbHistory) bool#

Returns 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