db.repositories
Repository helpers for webapp metadata tables.
This module owns CRUD-style access for imported_packages and
package_tables rows plus naming helpers used while importing txt files.
Functions
|
Convert free text into an ASCII-safe SQL identifier chunk. |
|
Create a safe SQLite table name that references package and txt source. |
|
Return imported package list for the Database View tab. |
|
Return txt tables for one package id. |
|
Delete one imported package and its associated dynamic txt tables. |
|
Return one package table metadata row by id. |
Module Contents
- db.repositories.slugify_identifier(value, max_length)
Convert free text into an ASCII-safe SQL identifier chunk.
- db.repositories.build_package_table_name(package_name, txt_stem, package_id, index)
Create a safe SQLite table name that references package and txt source.
- db.repositories.list_packages(conn)
Return imported package list for the Database View tab.
- db.repositories.list_package_tables(conn, package_id)
Return txt tables for one package id.
- db.repositories.delete_package(conn, package_id)
Delete one imported package and its associated dynamic txt tables.
Drops the physical SQLite tables created during import, removes the
package_tablesrows (via ON DELETE CASCADE), and finally removes theimported_packagesrow.- Parameters:
conn (sqlite3.Connection) – Open SQLite connection.
package_id (int) – Package id to delete.
- Returns:
Summary dict with deleted package name and table count.
- Raises:
ValueError – If the package id does not exist.
- Return type:
- db.repositories.get_package_table(conn, table_id)
Return one package table metadata row by id.