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-0.1.2.tar.gz (9.3 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-0.1.2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: olx_db_wonsky-0.1.2.tar.gz
  • Upload date:
  • Size: 9.3 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-0.1.2.tar.gz
Algorithm Hash digest
SHA256 aebc4b5277344d9759c2fd4566a346157252165c1e4c8bde1004931af5ff03a8
MD5 aae06d690467a4697dfc8497af7ea53c
BLAKE2b-256 37eee39f4ef69a14aed2b95f3553a9b15fb766b300ca3d565058e1181a0d4751

See more details on using hashes here.

File details

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

File metadata

  • Download URL: olx_db_wonsky-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 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-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8233405ce1fd265fd740494eb6c553018d6ac1eae3c3d170417d0dadc5c8ea06
MD5 f8683a2042d0a1ea083f36094da8c05e
BLAKE2b-256 917d6534ea94c29742ac8cada81c0ee8b533f80aedf9b42f481cbf8a7afb8397

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