14.2.64. camcops_server.cc_modules.cc_dump

camcops_server/cc_modules/cc_dump.py


Copyright (C) 2012-2019 Rudolf Cardinal (rudolf@pobox.com).

This file is part of CamCOPS.

CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <http://www.gnu.org/licenses/>.


Methods for providing a dump of data from the server to the web user.

class camcops_server.cc_modules.cc_dump.DumpController(dst_engine: sqlalchemy.engine.base.Engine, dst_session: sqlalchemy.orm.session.Session, export_options: TaskExportOptions, req: CamcopsRequest)[source]

A controller class that manages the copying (dumping) of information from our database to another SQLAlchemy Engine/Session.

Parameters:
consider_object(src_obj: object) → None[source]

Think about an SQLAlchemy ORM object. If it comes from a table we want dumped, add this object to the dump.

gen_all_dest_columns() → Generator[[sqlalchemy.sql.schema.Column, NoneType], NoneType][source]

Generates all destination columns.

gen_all_dest_tables() → Generator[[sqlalchemy.sql.schema.Table, NoneType], NoneType][source]

Generates all destination tables.

gen_all_dest_tables_for_obj(src_obj: object) → Generator[[sqlalchemy.sql.schema.Table, NoneType], NoneType][source]

Generates all destination tables for an object.

get_dest_table_for_est(est: ExtraSummaryTable, add_extra_id_cols: bool = False) → sqlalchemy.sql.schema.Table[source]

Add an additional summary table to the dump, if it’s not there already. Return the table (from the destination database).

Parameters:
get_dest_table_for_src_object(src_obj: object) → sqlalchemy.sql.schema.Table[source]

Produces the destination table for the source object.

Parameters:src_obj – An SQLAlchemy ORM object. It will not be a camcops_server.cc_modules.cc_summaryelement.ExtraSummaryTable; those are handled instead by _get_or_insert_summary_table().
Returns:an SQLAlchemy Table
camcops_server.cc_modules.cc_dump.copy_tasks_and_summaries(tasks: Iterable[camcops_server.cc_modules.cc_task.Task], dst_engine: sqlalchemy.engine.base.Engine, dst_session: sqlalchemy.orm.session.Session, export_options: TaskExportOptions, req: CamcopsRequest) → None[source]

Copy a set of tasks, and their associated related information (found by walking the SQLAlchemy ORM tree), to the dump.

Parameters: