Package helpers :: Module SyncDb
[hide private]

Module SyncDb

source code

Fills an empty database with the latest data in the WSA/VSA. Will also update the database schema and/or recreate the database from scratch. By default, the full date range of non-deprecated data is synchronised.


Note: For the detection tables of deep surveys, i.e. UDS and DXS, only the detections from the deep stacks are synchronised, as these are the only ones that contribute to source tables. If you specify the -a/--all option, then all detections are included.

To Do:

Author: R.S. Collins

Organization: WFAU, IfA, University of Edinburgh

Classes [hide private]
  SyncDb
Updates a database with the latest schema and data from another database up to the given CU level (0 = curation-data; 1 = transfer-data; 3 = metadata; 4 = detections; 7 = sources; 16 = neighbours).
Functions [hide private]
 
createDatabase(database, server, cli)
Creates a new database, overwriting the old one, with all necessary tables and initial curation data.
source code
 
createSurveyTables(db, cuID)
Creates empty survey data tables.
source code
tuple(str, Database)
defineDatabase(cli)
Defines the type of database to be synchronised.
source code
 
loadCurationTables(curationTables, fromDb, toDb, cli)
Loads the curation tables with the initial curation data.
source code
 
releaseDatabase(database, server)
Copies database from load to release servers and set user name permissions.
source code
Variables [hide private]
  __package__ = 'helpers'
Function Details [hide private]

createDatabase(database, server, cli)

source code 

Creates a new database, overwriting the old one, with all necessary tables and initial curation data.

Parameters:
  • database (Database) - Database object to create.
  • server (str) - Name of server to create database on.
  • cli (CLI) - Command-line options.

createSurveyTables(db, cuID)

source code 

Creates empty survey data tables.

Parameters:
  • db (DbSession) - Connection to the database where the tables are to be created.
  • cuID (int) - Curation ID level to copy data to. If 0 or 1 then non-survey tables are created too, otherwise you have to select an individual non-survey as the programme option to copy its tables.

defineDatabase(cli)

source code 

Defines the type of database to be synchronised.

Parameters:
  • cli (CLI) - Command-line options.
Returns: tuple(str, Database)
Server name that hosts the database and the database description.

loadCurationTables(curationTables, fromDb, toDb, cli)

source code 

Loads the curation tables with the initial curation data.

Parameters:
  • curationTables (list(schema.Table)) - List of curation table schemas.
  • fromDb (DbSession) - Database connection from which data should be copied.
  • toDb (DbSession) - Database connection to which data should be copied.
  • cli (CLI) - Command-line options.

releaseDatabase(database, server)

source code 

Copies database from load to release servers and set user name permissions.

Parameters:
  • database (Database) - Database object to create.
  • server (str) - Name of server to create database on.