timApp.timdb package#

Submodules#

timApp.timdb.dbaccess module#

timApp.timdb.dbaccess.get_files_path() pathlib.Path[source]#
timApp.timdb.dbaccess.get_timdb() timApp.timdb.timdb.TimDb[source]#

Returns the TimDb object and stores it in the Flask g object.

timApp.timdb.exceptions module#

exception timApp.timdb.exceptions.InvalidReferenceException[source]#

Bases: timApp.timdb.exceptions.TimDbException

The exception that is thrown when a referenced paragraph or area is not found.

exception timApp.timdb.exceptions.ItemAlreadyExistsException[source]#

Bases: timApp.timdb.exceptions.TimDbException

exception timApp.timdb.exceptions.PreambleException[source]#

Bases: timApp.timdb.exceptions.TimDbException

Thrown when an error occurs related to preamble processing.

exception timApp.timdb.exceptions.TimDbException[source]#

Bases: Exception

The exception that is thrown when an error occurs during a TimDb operation.

timApp.timdb.init module#

Initializes the TIM database.

timApp.timdb.init.check_db_version(_, context: alembic.runtime.migration.MigrationContext)[source]#
timApp.timdb.init.create_enrollment_types(sess)[source]#

Initializes the enrollment types used in TIM-calendar event enrollments

timApp.timdb.init.create_style_docs() tuple[list[timApp.folder.folder.Folder], list[timApp.document.docinfo.DocInfo]][source]#
timApp.timdb.init.database_has_tables()[source]#
timApp.timdb.init.exit_if_not_db_up_to_date()[source]#
timApp.timdb.init.initialize_database(create_docs: bool = True) None[source]#
timApp.timdb.init.postgre_create_database(db_uri: str)[source]#

timApp.timdb.sqa module#

Defines the SQLAlchemy object “db” that is used by all model classes by inheriting from db.Model.

__tablename__ is not mandatory but recommended in order to maintain the naming convention for tables. The default table name is class name in lowercase.

Use Flask-Migrate for database migrations. See <http://flask-migrate.readthedocs.io/en/latest/>.

class timApp.timdb.sqa.TimeStampMixin[source]#

Bases: object

created = Column(None, DateTime(timezone=True), table=None, default=ColumnDefault(<sqlalchemy.sql.functions.now at 0x7f2b47bff670; now>))#
modified = Column(None, DateTime(timezone=True), table=None, onupdate=ColumnDefault(<sqlalchemy.sql.functions.now at 0x7f2b47bff8e0; now>), default=ColumnDefault(<sqlalchemy.sql.functions.now at 0x7f2b47bff8b0; now>))#
timApp.timdb.sqa.get_tim_main_engine()[source]#
timApp.timdb.sqa.include_if_exists(attr_name: str, obj)[source]#
timApp.timdb.sqa.include_if_loaded(attr_name: str, obj, key_name=None)[source]#
timApp.timdb.sqa.is_attribute_loaded(attr_name, obj)[source]#
timApp.timdb.sqa.tim_main_execute(sql: str, params=None)[source]#

timApp.timdb.timdb module#

Defines the TimDb database class.

class timApp.timdb.timdb.TimDb(files_root_path: pathlib.Path, current_user_name: str = 'Anonymous', route_path: str = '')[source]#

Bases: object

DEPRECATED CLASS, DO NOT ADD NEW CODE!

Handles saving and retrieving information from TIM database.

close() None[source]#

Closes the database connection.

commit()[source]#

Commits any changes to the database.

get_pg_connections()[source]#

Returns the number of clients currently connected to PostgreSQL.

instances = 0#
open()[source]#
reset_attrs()[source]#

Module contents#