4.3.1. StandaloneTools package

Submodules

StandaloneTools.GenerateSecretKey module

GenerateSecretKey.py - program to generate a secret key.

StandaloneTools.LoadLocationData module

LoadLocationData.py - Load location data into Row/Bin/Tier and Location tables.

Although the Constraints table has the min/max or list values this program needs, the values are hard coded here because the records in the Constraints table are about to go away.

The philosophy used here is that there are certain essential rows, bins, and tiers that make up the components of warehouse locations. This program will add those rows, bins, tiers and locations to the database. This program doesn’t care if the descriptions for these records have changed, but requires that records with specific keys must be present in the database. Once the database has been pre-loaded, the users are free to make changes as desired.

StandaloneTools.LoadLocationData.BIN_MAX = 9

Maximum bin number

StandaloneTools.LoadLocationData.BIN_MIN = 1

Minimum bin number

StandaloneTools.LoadLocationData.ECHO_SQL_TO_LOG = True

Indicator of if the SQL statements should be copied to the log

class StandaloneTools.LoadLocationData.LoadLocationDataClass[source]

Bases: object

LoadLocationDataClass - Load location data into location tables.

class LocBin(**kwargs)[source]

Bases: sqlalchemy.ext.automap.Base

Location Bin table definition

class LocRow(**kwargs)[source]

Bases: sqlalchemy.ext.automap.Base

Location Row table definition

class LocTier(**kwargs)[source]

Bases: sqlalchemy.ext.automap.Base

Location Tier table definition

class Location(**kwargs)[source]

Bases: sqlalchemy.ext.automap.Base

Location table definition

connect(user: str, password: str, db: str, host: str = 'localhost', port: int = 5432) → <module ‘sqlalchemy.engine’ from ‘/home/docs/checkouts/readthedocs.org/user_builds/food-pantry-inventory/envs/dev/lib/python3.8/site-packages/sqlalchemy/engine/__init__.py’>[source]

Establish a connection to the desired PostgreSQL database.

Parameters
  • user

  • password

  • db

  • host

  • port

Returns

load_bin_table(session: sessionmaker(class_=’Session’, bind=None, autoflush=True, autocommit=False, expire_on_commit=True))[source]

Load the bin table with values from min to max.

Returns

load_location_table(session: sessionmaker(class_=’Session’, bind=None, autoflush=True, autocommit=False, expire_on_commit=True))[source]

Construct location records from the row/bin/tier records.

The location code consists of the row code, bin code, and tier code jammed together into a six character id.

Returns

load_row_table(session: sessionmaker(class_=’Session’, bind=None, autoflush=True, autocommit=False, expire_on_commit=True))[source]

Load the row table with values from min to max.

Session

Returns

load_tier_table(session: sessionmaker(class_=’Session’, bind=None, autoflush=True, autocommit=False, expire_on_commit=True))[source]

Load the tier table with values from the list.

Returns

run_load_loc_data()[source]

Top method for running Load location data into tables.

Returns

class StandaloneTools.LoadLocationData.Main[source]

Bases: object

Main class to start things rolling.

run_load_loc_data()[source]

Prepare to run Load location data into tables.

Returns

static start_logging(work_dir: pathlib.Path, debug_name: str)[source]

Establish the logging for all the other scripts.

Parameters
  • work_dir

  • debug_name

Returns

(nothing)

StandaloneTools.LoadLocationData.ROW_MAX = 4

Maximum row number

StandaloneTools.LoadLocationData.ROW_MIN = 1

Minimum row number

StandaloneTools.LoadLocationData.TIER_LIST = ['A1', 'A2', 'B1', 'B2', 'C1', 'C2']

List of valid tier names

StandaloneTools.LoadLocationData.log = None

# # # # # Constants # # # # #

StandaloneTools.LoadLocationData.session_scope()[source]

Provide a transactional scope around a series of operations.

StandaloneTools.dump_group_permissions module