Skip to main content

OLX database models and migrations

Project description

OLX Database Package

A Python package for OLX database models and migrations.

Installation

pip install olx-db

For development installation:

pip install -e .

Configuration

The package uses environment variables for configuration:

  • OLX_DB_URL: Database URL (required)
  • OLX_DEFAULT_SENDING_FREQUENCY_MINUTES: Default sending frequency in minutes (default: 60)
  • OLX_DEFAULT_LAST_MINUTES_GETTING: Default last minutes for getting items (default: 30)

You can set these environment variables directly or use a .env file.

Usage

Database Models

from olx_db.db import get_db, MonitoringTask, ItemRecord

# Use the database session
with next(get_db()) as db:
    tasks = db.query(MonitoringTask).all()
    # ...

Migrations

To create a new migration:

olx-db-makemigrations "migration message"

To apply migrations:

olx-db-migrate

Docker Support

Example docker-compose.yml:

version: '3'

services:
  app:
    build: .
    environment:
      - OLX_DB_URL=postgresql://user:password@db:5432/olx
    depends_on:
      - db
    command: olx-db-migrate

  db:
    image: postgres:13
    environment:
      - POSTGRES_USER=user
      - POSTGRES_PASSWORD=password
      - POSTGRES_DB=olx
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:

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

olx_db_wonsky-1.1.3.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

olx_db_wonsky-1.1.3-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file olx_db_wonsky-1.1.3.tar.gz.

File metadata

  • Download URL: olx_db_wonsky-1.1.3.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for olx_db_wonsky-1.1.3.tar.gz
Algorithm Hash digest
SHA256 6e1c14387db6567c31d2405d92dabc87a20fc2afb4735158f537a6208d835374
MD5 7847812c4bd088336d0c36d8708ff621
BLAKE2b-256 09f04d7f9bc5a0c55604e4e3fe3864f7b5be3768ab8921907a612aac1a0cfb9e

See more details on using hashes here.

File details

Details for the file olx_db_wonsky-1.1.3-py3-none-any.whl.

File metadata

  • Download URL: olx_db_wonsky-1.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for olx_db_wonsky-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d73480a6dbda33b134e6dc6448737597e817e9c5d8c112f92a8a1febe1ee0f49
MD5 f6d25b9841100fd031235937737fcc52
BLAKE2b-256 970dbad844e156a072aa8feb4ec1e4cde59c9d2a8033b3bd97c210d0aa365972

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