standard.load_sample_data

Module Contents

Classes

SampleData(self,configuration,section=”pyramid_oereb”,directory=”sample_data”,sql_file=None) Class for sample data handling.

Functions

_run() Loads sample data from the json files with the repository. The method can be called by running
class SampleData(configuration, section="pyramid_oereb", directory="sample_data", sql_file=None)

Class for sample data handling.

__init__(configuration, section="pyramid_oereb", directory="sample_data", sql_file=None)

Args: configuration (str): Path to the configuration yaml file. section (str): The used section within the yaml file. Default is pyramid_oereb. directory (str): Location of the sample data. Default is sample_data. sql_file (file): The SQL file to be created. Default is None.

_format_value(value)

Format the value in SQL.

Args:
value (str): The value
Returns:
str: The formatted value
_do_sql_insert(sql, items)

Write the SQL inserts in a file.

Args:
sql (str): The based SQL statement items (array): The values
_has_connection()

Returns True if an active connection is available.

Returns:
bool: True if an active connection is available.
_load_sample(class_, import_file_name)

Load the samples in the database ir in an SQL file.

Args:
class_ (sqlalchemy.ext.declarative.ConcreteBase): SQLAlchemy class import_file_name (str): The resource file name to import
_truncate_existing(schema)

Truncates existing tables.

load()

Performs the database operations to load the sample data.

_run()

Loads sample data from the json files with the repository. The method can be called by running ‘load_sample_data’ from the virtual environment. Check ‘load_sample_data –help’ for available options.