Command Line Interface

The gs1-gpc package provides a command-line interface (CLI) for importing GS1 GPC data into a database.

Commands

import-gpc

Import GS1 GPC data into a database.

gpc import-gpc [OPTIONS]

Options:

  • --xml-file PATH: Path to the input GS1 GPC XML file

  • --db-file PATH: Path to the output database file

  • --db-type [sqlite|postgresql]: Database type (default: sqlite)

  • --download: Download the latest GPC data before import

  • --language TEXT: Language code for GPC data download (default: en)

  • --dump-sql: Dump database tables to SQL file after import

  • --verbose, -v: Enable detailed debug logging

  • --quiet, -q: Suppress all logging except errors

  • --help: Show help message and exit

export-sql

Export database tables to SQL file.

gpc export-sql [OPTIONS]

Options:

  • --db-file PATH: Path to the SQLite database file

  • --language TEXT: Language code for the SQL filename (default: en)

  • --help: Show help message and exit

Examples

Basic Import

gpc import-gpc

Download Latest Data

gpc import-gpc --download

Specify Language

gpc import-gpc --download --language fr

Custom Files

gpc import-gpc --xml-file ./my_custom_file.xml --db-file ./my_database.sqlite3

Export Database to SQL

gpc import-gpc --dump-sql

Export Only (No Import)

gpc export-sql --db-file ./data/instances/gpc_data_xml.sqlite3

PostgreSQL Support

gpc import-gpc --db-type postgresql --db-file "postgresql://user:password@localhost/dbname"

Verbose Logging

gpc import-gpc --verbose