Exporter Module
SQL export functionality for GS1 GPC.
This module provides classes for exporting database tables to SQL files.
The main class is GPCExporter which handles exporting GPC data from a SQLite database to SQL files. A legacy function is provided for backward compatibility but new code should use the GPCExporter class.
- class gs1_gpc.exporter.GPCExporter(export_dir=None, language_code='en')[source]
Bases:
objectClass for exporting GS1 GPC data from a database to SQL files.
This class provides methods to export GPC data from a SQLite database to SQL files. It extracts only the GPC-related tables (those with names starting with ‘gpc_’) and creates a SQL dump file that can be used to recreate the database.
- dump_database_to_sql(db_file_path)[source]
Dump all GPC tables from the SQLite database to a SQL file.
This method extracts all tables with names starting with ‘gpc_’ from the specified SQLite database and creates a SQL dump file. The dump file includes both the table structure (CREATE statements) and the data (INSERT statements).
The SQL file is saved in the export directory with the naming convention: {language_code}-v{date}.sql