common.database.backends.general package

Submodules

common.database.backends.general.DBGeneral_Context module

common.database.backends.general.DBGeneral_DB module

common.database.backends.general.DBGeneral_Database module

class common.database.backends.general.DBGeneral_Database.DBGeneralDatabase

Bases: common.database.DatabaseInterface.DatabaseInterface

The singleton Database definition.

classmethod awschema()

return the database schema, determined by the environment or else username

clear_all_state()

Clear all state from the database object (connections, object cache) This should be used when a child process is spawned

clear_objcache()

clear the object cache for the current thread

connected()

returns the connection if connected otherwise None

connections = {}
del_objcache(obj_id)

remove the object (obj) with object_id from the cache

get_current_project()

Return the project that is currently active using the context

get_object_cache()

get or make the object cache for the current thread

objcache(object_id)

get the object with object_id from the cache

object_caches = {}
projects = {}
set_objcache(obj_id, obj)

place the object (obj) with object_id in the cache

set_project(name, privileges=0)

Set the current project

sso_authorize(ticket, sso_application='')

Authorize using the SSO ticket. The sso_application argument overrides the one in the Environment. Return whether the authorize succeeded; True or False.

username()

returns the username of the current connection

users = {}

common.database.backends.general.DBGeneral_Security module

Creates packages and context in PostgresSQL to support Astro-WISE Contexts.

This module creates the tables for AWEUSERS and AWEPROJECTS. For PostgreSQL they control the values inserted into the awecontet_sys table, which is then used in the join in VIEWs of tables.

common.database.backends.general.DBGeneral_Select module

The beginnings of an implementation for Logical Expression objects

These objects should be used by the database to build queries

class common.database.backends.general.DBGeneral_Select.LinkRef(prop, attr)

Bases: object

like(other)
class common.database.backends.general.DBGeneral_Select.Select(lhs, operator, rhs)

Bases: object

add_clause(operator, other_clause, other_param)

add the other_clause (and param) to self

copy()

Return coyp of self

current_mydb_only()

Only show mydb data of the current project. So do not show the mydb data of other projects ! But do show all other visible data.

get_input_sizes()
get_rows()

Generate query and return all object_id’s The Environment can contain directives to adjust the query, if so a copy of self is made and used

get_sql(select=None, rownum=0)

Get the sql from the query, default SELECT arguments are the type and object_id, use select argument to extend the rownum argument adds a where limit on the number of rows returned

max(attribute)

Return the item in a query for which “attribute” is largest.

min(attribute)

Return the item in a query for which “attribute” is smallest.

not_all_mydb()

Only show mydb data of the current project. So do not show the mydb data of other projects ! But do show all other visible data.

order_by(attribute)

Order the result of a query by increasing value of “attribute”.

order_by_desc(attribute)

Order the result of a query by decreasing value of “attribute”.

privileges_only(privileges=0)

limit the query to the given privileges

project_favourite()

Prefer project owned data over data from other projects.

project_only(project=None)

Filter the objects specific to the given project (name/id) or the current project.

public_data_only(public=True)

Limit the query to public data (when True) or private data when public is False

public_project_only(public=True, ids=[])

Limit the query to public projects (when public is True) or private projects when public is False or to the given project ids

user_only(user=None)

Filter the objects to the given user (name/id) or current user

vo_only()

Limit query to VO objects, so privileges 5

world_only()

Limit query to world objects, so privileges 4

common.database.backends.general.DBGeneral_Select.escape_orderby_clause(clause)
common.database.backends.general.DBGeneral_Select.instantiate_object(typeid, oid)
common.database.backends.general.DBGeneral_Select.sqlname(name)
common.database.backends.general.DBGeneral_Select.viewname(aclass)

common.database.backends.general.DBGeneral_support module

Module contents