# Mythologizer PostgreSQL
A PostgreSQL database connector for mythology data with vector embeddings, built with SQLAlchemy and pgvector.
## Installation
### Using uv (recommended)
```bash
# Install in development mode
uv pip install -e .
# Or install from PyPI (when published)
uv add mythologizer_postgres
```
### Using pip
```bash
pip install mythologizer_postgres
```
## Package Structure
The package is organized into the following structure:
```
mythologizer_postgres/
├── __init__.py # Core database functions
├── db.py # Database connection and utilities
├── schema.py # Database schema definitions
├── cli.py # Command-line interface
└── connectors/ # Data access layer
├── __init__.py # All connector functions
├── myth_store.py # Myth data operations
├── mytheme_store.py # Mytheme data operations
└── mythicalgebra/ # Myth algebra subpackage
├── __init__.py # Myth algebra functions
└── mythic_algebra_connector.py # Myth algebra operations
```
## Usage
### Core Database Functions
Direct imports from the main package:
```python
from mythologizer_postgres import (
get_engine,
get_session,
session_scope,
psycopg_connection,
apply_schemas,
check_if_tables_exist,
ping_db,
clear_all_rows,
get_table_row_counts,
MissingEnvironmentVariable,
need,
build_url,
)
# Example: Get a database session
with session_scope() as session:
# Your database operations here
pass
# Example: Check database connectivity
if ping_db():
print("Database is accessible")
```
### Connector Functions
Import all connector functions:
```python
from mythologizer_postgres.connectors import (
# Mytheme functions
get_mythemes_bulk,
get_mytheme,
insert_mythemes_bulk,
# Myth functions
insert_myth,
insert_myths_bulk,
get_myth,
get_myths_bulk,
update_myth,
update_myths_bulk,
delete_myth,
delete_myths_bulk,
# Myth algebra functions
get_myth_embeddings,
get_myth_matrices,
recalc_and_update_myths,
)
# Example: Get a myth by ID
myth = get_myth(123)
### Myth Algebra Functions
Import myth algebra functions specifically:
```python
from mythologizer_postgres.connectors.mythicalgebra import (
get_myth_embeddings,
get_myth_matrices,
recalc_and_update_myths,
)
# Example: Get myth embeddings
embeddings = get_myth_embeddings([123, 124, 125])
# Example: Get myth matrices
matrices = get_myth_matrices([123, 124, 125])
# Example: Recalculate and update myths
updated_ids = recalc_and_update_myths([123, 124, 125])
```
### Subpackage Access
You can also access the subpackages directly:
```python
import mythologizer_postgres.connectors as connectors
import mythologizer_postgres.connectors.mythicalgebra as mythicalgebra
# Use the functions
myth = connectors.get_myth(123)
embedding = mythicalgebra.get_myth_embeddings(123)
```
## Environment Variables
The package requires the following environment variables:
```bash
POSTGRES_USER=your_username
POSTGRES_PASSWORD=your_password
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=your_database
```
## Development
### Setup Development Environment
```bash
# Clone the repository
git clone <repository-url>
cd mythologizerDB
# Install in development mode
uv pip install -e .
# Run tests
uv run python test_imports.py
```
### Building the Package
```bash
# Build source distribution and wheel
uv build
Raw data
{
"_id": null,
"home_page": null,
"name": "mythologizer-postgres",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.13",
"maintainer_email": null,
"keywords": "postgresql, vector, embeddings, mythology, sqlalchemy, pgvector",
"author": null,
"author_email": "Pierre-Louis Suckrow <suckrowpierre@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/1a/cc/6a760398f8ab1c5a91f403ba7c1d1d4a0c93bef88b36fcdb5afca569595e/mythologizer_postgres-0.1.0.tar.gz",
"platform": null,
"description": "# Mythologizer PostgreSQL\n\nA PostgreSQL database connector for mythology data with vector embeddings, built with SQLAlchemy and pgvector.\n\n## Installation\n\n### Using uv (recommended)\n\n```bash\n# Install in development mode\nuv pip install -e .\n\n# Or install from PyPI (when published)\nuv add mythologizer_postgres\n```\n\n### Using pip\n\n```bash\npip install mythologizer_postgres\n```\n\n## Package Structure\n\nThe package is organized into the following structure:\n\n```\nmythologizer_postgres/\n\u251c\u2500\u2500 __init__.py # Core database functions\n\u251c\u2500\u2500 db.py # Database connection and utilities\n\u251c\u2500\u2500 schema.py # Database schema definitions\n\u251c\u2500\u2500 cli.py # Command-line interface\n\u2514\u2500\u2500 connectors/ # Data access layer\n \u251c\u2500\u2500 __init__.py # All connector functions\n \u251c\u2500\u2500 myth_store.py # Myth data operations\n \u251c\u2500\u2500 mytheme_store.py # Mytheme data operations\n \u2514\u2500\u2500 mythicalgebra/ # Myth algebra subpackage\n \u251c\u2500\u2500 __init__.py # Myth algebra functions\n \u2514\u2500\u2500 mythic_algebra_connector.py # Myth algebra operations\n```\n\n## Usage\n\n### Core Database Functions\n\nDirect imports from the main package:\n\n```python\nfrom mythologizer_postgres import (\n get_engine,\n get_session,\n session_scope,\n psycopg_connection,\n apply_schemas,\n check_if_tables_exist,\n ping_db,\n clear_all_rows,\n get_table_row_counts,\n MissingEnvironmentVariable,\n need,\n build_url,\n)\n\n# Example: Get a database session\nwith session_scope() as session:\n # Your database operations here\n pass\n\n# Example: Check database connectivity\nif ping_db():\n print(\"Database is accessible\")\n```\n\n### Connector Functions\n\nImport all connector functions:\n\n```python\nfrom mythologizer_postgres.connectors import (\n # Mytheme functions\n get_mythemes_bulk,\n get_mytheme,\n insert_mythemes_bulk,\n \n # Myth functions\n insert_myth,\n insert_myths_bulk,\n get_myth,\n get_myths_bulk,\n update_myth,\n update_myths_bulk,\n delete_myth,\n delete_myths_bulk,\n \n # Myth algebra functions\n get_myth_embeddings,\n get_myth_matrices,\n recalc_and_update_myths,\n)\n\n# Example: Get a myth by ID\nmyth = get_myth(123)\n\n### Myth Algebra Functions\n\nImport myth algebra functions specifically:\n\n```python\nfrom mythologizer_postgres.connectors.mythicalgebra import (\n get_myth_embeddings,\n get_myth_matrices,\n recalc_and_update_myths,\n)\n\n# Example: Get myth embeddings\nembeddings = get_myth_embeddings([123, 124, 125])\n\n# Example: Get myth matrices\nmatrices = get_myth_matrices([123, 124, 125])\n\n# Example: Recalculate and update myths\nupdated_ids = recalc_and_update_myths([123, 124, 125])\n```\n\n### Subpackage Access\n\nYou can also access the subpackages directly:\n\n```python\nimport mythologizer_postgres.connectors as connectors\nimport mythologizer_postgres.connectors.mythicalgebra as mythicalgebra\n\n# Use the functions\nmyth = connectors.get_myth(123)\nembedding = mythicalgebra.get_myth_embeddings(123)\n```\n\n## Environment Variables\n\nThe package requires the following environment variables:\n\n```bash\nPOSTGRES_USER=your_username\nPOSTGRES_PASSWORD=your_password\nPOSTGRES_HOST=localhost\nPOSTGRES_PORT=5432\nPOSTGRES_DB=your_database\n```\n\n## Development\n\n### Setup Development Environment\n\n```bash\n# Clone the repository\ngit clone <repository-url>\ncd mythologizerDB\n\n# Install in development mode\nuv pip install -e .\n\n# Run tests\nuv run python test_imports.py\n```\n\n### Building the Package\n\n```bash\n# Build source distribution and wheel\nuv build\n",
"bugtrack_url": null,
"license": null,
"summary": "PostgreSQL database connector for mythology data with vector embeddings",
"version": "0.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/yourusername/mythologizerDB/issues",
"Documentation": "https://github.com/yourusername/mythologizerDB#readme",
"Homepage": "https://github.com/yourusername/mythologizerDB",
"Repository": "https://github.com/yourusername/mythologizerDB"
},
"split_keywords": [
"postgresql",
" vector",
" embeddings",
" mythology",
" sqlalchemy",
" pgvector"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "7c236a703e98a3f5f35c14115ec988b76ae6720620ea028b3921dde3de9a457b",
"md5": "fa673da4b1a2f37e69502f1cd50405f5",
"sha256": "2fd16b08c4262169ca04b98594164b2bc4877379308ebb9d808917453f0dec9b"
},
"downloads": -1,
"filename": "mythologizer_postgres-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa673da4b1a2f37e69502f1cd50405f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.13",
"size": 28563,
"upload_time": "2025-08-07T10:18:24",
"upload_time_iso_8601": "2025-08-07T10:18:24.005862Z",
"url": "https://files.pythonhosted.org/packages/7c/23/6a703e98a3f5f35c14115ec988b76ae6720620ea028b3921dde3de9a457b/mythologizer_postgres-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1acc6a760398f8ab1c5a91f403ba7c1d1d4a0c93bef88b36fcdb5afca569595e",
"md5": "bf52e61472f20b89a901454af7a8a162",
"sha256": "b4390bd9eb0ba3c8497934a75e2026f602540809ee0c90b61377cc611539d09b"
},
"downloads": -1,
"filename": "mythologizer_postgres-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "bf52e61472f20b89a901454af7a8a162",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.13",
"size": 39211,
"upload_time": "2025-08-07T10:18:25",
"upload_time_iso_8601": "2025-08-07T10:18:25.701944Z",
"url": "https://files.pythonhosted.org/packages/1a/cc/6a760398f8ab1c5a91f403ba7c1d1d4a0c93bef88b36fcdb5afca569595e/mythologizer_postgres-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-07 10:18:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "mythologizerDB",
"github_not_found": true,
"lcname": "mythologizer-postgres"
}