common.database.backends.db2 package

Submodules

common.database.backends.db2.DB2_Context module

common.database.backends.db2.DB2_DB module

common.database.backends.db2.DB2_Database module

common.database.backends.db2.DB2_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.

class common.database.backends.db2.DB2_Security.SecurityPackage

Bases: object

delete_object(p_object_type, p_object_id, p_outsideproject=0, p_project=0)
get_ref_count(p_object_type, p_object_id, p_outsideproject=0, p_project=0)
update_allowed(p_object_type, p_object_id)
update_attrebute(p_update_attr, p_class_dmlname, p_object_id, p_new_value, p_commit=True)
common.database.backends.db2.DB2_Security.add_adminuser(p_schema, p_username, p_awesuperuser='N', p_commit=True)
common.database.backends.db2.DB2_Security.add_grants_to_usersroles(p_parentschema, p_prefix, p_commit=True)
common.database.backends.db2.DB2_Security.add_project(p_projectname, p_description='', p_default_provilages=2, p_instrument='', p_commit=True)
common.database.backends.db2.DB2_Security.add_projectuser(p_schema, p_projectname, p_username, p_usertype=0, p_commit=True)
common.database.backends.db2.DB2_Security.add_projectuser_idid(p_schema, p_projectid, p_userid, p_usertype=0, p_commit=True)
common.database.backends.db2.DB2_Security.add_user(p_username, p_fullname='', p_email='', p_password='', p_readonly='N', p_commit=True)
common.database.backends.db2.DB2_Security.create_all_awe_views(p_parentschema, p_commit=True)
common.database.backends.db2.DB2_Security.create_awedatabasecontext()
common.database.backends.db2.DB2_Security.create_global_awesequence(p_schema, p_commit=True)
common.database.backends.db2.DB2_Security.create_global_awesysguidsequence(p_schema, p_commit=True)
common.database.backends.db2.DB2_Security.create_now_utc_function(p_schema, p_commit=True)
common.database.backends.db2.DB2_Security.create_obj_delete(p_commit=True)
common.database.backends.db2.DB2_Security.create_schema_objects_ref_table(p_schema, p_commit=True)
common.database.backends.db2.DB2_Security.create_set_awecontext_fordb_function(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_aweadminusers(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_awecontext(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_aweinit(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_aweprojects(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_aweprojectusers(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_awesessions(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_aweusers(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_awevocabulary_classattr(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_awevocabulary_classes(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_awevocabulary_classes_prop(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_awevocabulary_classes_ref_table(p_commit=True)
common.database.backends.db2.DB2_Security.create_table_awevocabulary_tablesviews(p_commit=True)
common.database.backends.db2.DB2_Security.create_trigger_after_insert(tablename, p_commit=True)
common.database.backends.db2.DB2_Security.create_trigger_after_update(tablename, p_commit=True)
common.database.backends.db2.DB2_Security.create_trigger_before_insert(tablename, p_commit=True)
common.database.backends.db2.DB2_Security.create_trigger_before_update(tablename, p_commit=True)
common.database.backends.db2.DB2_Security.drop_global_awesequence(p_schema, p_commit=True)
common.database.backends.db2.DB2_Security.drop_global_awesysguidsequence(p_schema, p_commit=True)
common.database.backends.db2.DB2_Security.drop_now_utc_function(p_schema, p_commit=True)
common.database.backends.db2.DB2_Security.truncate_vocabulary(p_commit=True)

common.database.backends.db2.DB2_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.db2.DB2_Select.LinkRef(prop, attr)

Bases: object

like(other)
class common.database.backends.db2.DB2_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.db2.DB2_Select.escape_orderby_clause(clause)
common.database.backends.db2.DB2_Select.instantiate_object(typeid, oid)
common.database.backends.db2.DB2_Select.sqlname(name)
common.database.backends.db2.DB2_Select.viewname(aclass)

common.database.backends.db2.DB2_support module

Module contents