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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file olx_db_wonsky-0.1.1.tar.gz.
File metadata
- Download URL: olx_db_wonsky-0.1.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a9d5ea08ff2f18b794094255ab8ddfc0e4df76645f54b558681b5bcd598f961
|
|
| MD5 |
45e14eea20be9e8dc6051e7dc7c8214f
|
|
| BLAKE2b-256 |
8bdd502b5cf51544787c66bfb03bea47d2d5480227a7af0f51a32fd7ff785c31
|
File details
Details for the file olx_db_wonsky-0.1.1-py3-none-any.whl.
File metadata
- Download URL: olx_db_wonsky-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0838e8c45b660bcf20a2b9c3eee62d4f931b335d999ef9cb07164864daf86a2
|
|
| MD5 |
84d0c3c0ee0eaee21b28fda158ce25c2
|
|
| BLAKE2b-256 |
4c281964396545bf6d8dd25e34c29d89f45e8696d276642eeed9bb27a1b6f186
|