14.7.3. crate_anon.preprocess.ddhint
crate_anon/preprocess/ddhint.py
Copyright (C) 2015, University of Cambridge, Department of Psychiatry. Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
This file is part of CRATE.
CRATE 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.
CRATE 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 CRATE. If not, see <https://www.gnu.org/licenses/>.
Hint class for data dictionary generation.
- class crate_anon.preprocess.ddhint.DDHint[source]
Represents a hint for creating data dictionaries.
- add_bulk_source_index_request(table_columns_dict: Dict[str, List[str]]) None [source]
Adds multiple index requests for the source database. (See
add_source_index_request()
.)- Parameters:
table_columns_dict – dictionary mapping
tablename: columns
, wheretablename
is a string table name, andcolumns
is a single column name as a string or an iterable of multiple column names
- add_source_index_request(table: str, columns: str | Iterable[str]) None [source]
Adds a request to index tables on the source database.
- Parameters:
table – table name
columns – single column name (string) or iterable of multiple column names
- create_indexes(engine: Engine, metadata: MetaData) None [source]
Creates indexes in the source database according to instructions we have previously received via
add_source_index_request()
and/oradd_bulk_source_index_request()
.- Parameters:
engine – SQLAlchemy database Engine
metadata – SQLAlchemy ORM Metadata
- drop_indexes(engine: Engine, metadata: MetaData) None [source]
Drop indexes from the source database. Reverses the effects of
create_indexes()
.- Parameters:
engine – SQLAlchemy database Engine
metadata – SQLAlchemy ORM Metadata
- suppress_table(table: str) None [source]
Adds a table to the “suppress table” list. This is intended to represent source tables that you don’t want to appear in the destination database (usually because you have made a copy in a nicer format).
- Parameters:
table – name of the table
- suppress_tables(tables: Iterable[str]) None [source]
Adds multiple tables to the “suppress table” list. See
suppress_table()
.- Parameters:
tables – iterable of table names