Skip to main content

Python NopCommerce CLI and DB access (MSSQL/pyodbc)

Project description

pynop-cli

Python NopCommerce CLI and database access for MSSQL (pyodbc). Extracted from the sync project for standalone use.

Features

  • DB layer: AutoDao and DB for MSSQL (pyodbc) with parameterized queries.
  • NopCommerce helpers: NopTool, NopData, NopQuery for product, category, picture, manufacturer, and related Nop entities.
  • CLI: nopcommerce command for quick queries and inspections.

Installation

pip install -e .
# or from PyPI (when published): pip install pynop-cli

Requires ODBC Driver 17 for SQL Server (or compatible) and a working MSSQL instance.

Configuration

Connection is via a config dict or environment variables.

Config dict (e.g. when used from another app):

from pynop import AutoDao, NopTool, NopData

config = {
    "db_engine": "MSSQL",
    "db_server": "your-server",
    "db_name": "NOPCommerce",
    "db_username": "sa",
    "db_password": "secret",
}
dao = AutoDao(config)
# Optional: set as default for NopTool
NopTool.set_dao(dao)

Environment variables (for CLI or standalone scripts):

  • NOP_DB_SERVER, NOP_DB_NAME, NOP_DB_USERNAME, NOP_DB_PASSWORD
  • Or NOP_DB_DSN for DSN-based connection.

CLI

nopcommerce product get-by-sku MY-SKU
nopcommerce product list --limit 10
nopcommerce ping

Use from sync project

In the sync repo, install this package and use a thin adapter in core/db.py that imports AutoDao from pynop and passes DB_CONFIG[env][db_type] so existing AutoDao("nop") / AutoDao("staging") calls keep working.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynop_cli-0.1.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynop_cli-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file pynop_cli-0.1.0.tar.gz.

File metadata

  • Download URL: pynop_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for pynop_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d92d75579be5de83c355d3c1b76e823cab036f5a9bad8fc92631139a69ebf6b
MD5 eba0ac92006920eecac71e3257c798e8
BLAKE2b-256 c2ecdb92b15f5b163bf1e09f34b0fcc92413c2bfe1191467accefbf972ef2071

See more details on using hashes here.

File details

Details for the file pynop_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pynop_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for pynop_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69dd1df05bd8fb94f4307c9029981b714846dc5e76bc61c7036b9fc1303ae0b1
MD5 26cd688efd8e4e9c58e549614d5b87d8
BLAKE2b-256 af7f9bfb52893ebee2d00e0276c834170cac979c31cc37e839b0e59619f7caff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page