Database Module
Database operations for GS1 GPC.
This module provides functions for setting up and interacting with the database, including creating tables and inserting data.
- class gs1_gpc.db.DatabaseConnection(connection_string, db_type='sqlite')[source]
Bases:
objectDatabase connection abstraction for SQLite and PostgreSQL.
- gs1_gpc.db.setup_database(db_connection)[source]
Create GPC tables if they don’t exist.
- Parameters:
db_connection (DatabaseConnection) – Database connection object
- Returns:
True if successful, False otherwise
- Return type:
- gs1_gpc.db.insert_family(cursor, family_code, description, segment_code)[source]
Insert a family record.
- gs1_gpc.db.insert_class(cursor, class_code, description, family_code)[source]
Insert a class record.
- gs1_gpc.db.insert_brick(cursor, brick_code, description, class_code)[source]
Insert a brick record.
- gs1_gpc.db.insert_attribute_type(cursor, att_type_code, att_type_text, brick_code)[source]
Insert an attribute type record.