Skip to main content

pg-comtrade PyPI package Test suite Code coverage

Python utility function to ingest data from UN Comtrade's bulk API into a (partitioned) PostgreSQL table.

[!IMPORTANT] This is a work-in-progress. This README serves as a rough design spec.

Installation

pg-comtrade can be installed from PyPI using pip. psycopg2 or psycopg (Psycopg 3) must also be explicitly installed.

pip install pg-comtrade psycopg

Usage

from pg_comtrade import sync_goods_yearly

# For example purposes, PostgreSQL can be run locally using this...
# docker run --rm -it -e POSTGRES_HOST_AUTH_METHOD=trust -p 5432:5432 postgres

# ... which should work with this engine
engine = sa.create_engine('postgresql+psycopg://postgres@127.0.0.1:5432/')

# ... to ingest into the un.comtrade_goods table
with engine.connect() as conn:
    sync_goods_yearly(conn, 'un', 'comtrade_goods', subscription_key='123456abcdef')

Development / running tests

To develop pg-comtrade, you will need to install the package in editable mode, and install development dependencies.

pip install -e '.[dev]'

And start a local PostgreSQL server:

./start-services.sh

And then to run the tests:

pytest

Metadata

Release files for pg-comtrade 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pg-comtrade 0.0.2
File Size Uploaded Provenance
pg_comtrade-0.0.2.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pg-comtrade 0.0.2
File Interpreter ABI Platform
pg_comtrade-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / pg_comtrade-0.0.2.tar.gz

Download URL pg_comtrade-0.0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
435c155b73c144b0462b0f19535b84555c80f3874182e241d25e830f8c40df8c
BLAKE2b-256 checksum
How to use checksums
7e4e46f90be0cfb7408e500b7a6070bdb46e1221003e2c93f97d0d6865f4dc16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / pg_comtrade-0.0.2-py3-none-any.whl

Download URL pg_comtrade-0.0.2-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8a64223366a4f01360b9d190ba0911e5ca720ff15ac41f3948dfed5edf687f4
BLAKE2b-256 checksum
How to use checksums
c94b879a30d655b2ddfce61b50c105805cda2f93c0ecc9983f65e8173f35ac83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Security for pg-comtrade 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page