Skip to main content

ORM leve com introspecção automática para bancos JDBC como Informix, usando integração com wbjdbc.

Project description

PyPI PyPI - Downloads Build Status License: MIT Último Commit GitHub issues GitHub forks GitHub stars

WBORM

WBORM é uma biblioteca ORM leve para Python, projetada para funcionar diretamente com bancos de dados legados via JDBC, como Informix, DB2, Oracle e outros. Com foco em transparência, segurança e introspecção automática, ela é a parceira ideal da wbjdbc, entregando produtividade sem esconder o SQL.


✨ Destaques

  • Suporte completo a conexões JDBC via wbjdbc
  • Geração automática de modelos com introspecção
  • API fluente com .select(), .filter(), .join() e mais
  • Confirmação obrigatória em operações destrutivas
  • Bloqueio de UPDATE/DELETE sem WHERE
  • Transações automáticas com rollback
  • Integração com Pandas e Spark
  • Eager/lazy loading, cache, hooks e muito mais

📁 Instalação

pip install wborm wbjdbc

🚀 Começando Rápido

1. Conectando via wbjdbc

from wbjdbc import connect_to_db

conn = connect_to_db(
    db_type="informix-sqli",
    host="localhost",
    port=1526,
    database="meubanco",
    user="usuario",
    password="senha",
    server="ol_informix"
)

2. Gerando modelo com introspecção

from wborm.utils import generate_model

Cliente = generate_model("clientes", conn)

Isso detecta automaticamente os campos, tipos, PKs e campos nulos da tabela!

3. Consultando dados

clientes = Cliente.filter(idade=30).order_by("nome").all()
for c in clientes:
    print(c.nome)

🛠️ Definindo modelos manualmente (opcional)

from wborm.core import Model
from wborm.fields import Field

class Cliente(Model):
    __tablename__ = "clientes"
    id = Field(int, primary_key=True)
    nome = Field(str)
    idade = Field(int)

Cliente._connection = conn

Ideal para quem quer customizar comportamento, usar create_table() ou definir campos antes de existir no banco.


🔒 Segurança embutida

  • .add(), .update() e .delete() exigem confirm=True
  • UPDATE/DELETE sem WHERE são bloqueados
  • Transações com BEGIN WORK / COMMIT / ROLLBACK

📊 Integração com Pandas e Spark

import pandas as pd

clientes = Cliente.all()
df = pd.DataFrame([c.to_dict() for c in clientes])
spark.createDataFrame([c.to_dict() for c in Cliente.all()])

📖 Documentação completa

Acesse: https://wanderbatistaf.github.io/wborm

Inclui:

  • Guia de Início Rápido
  • Modelos com introspecção
  • Operadores, joins, filtros, agrupamentos
  • Lazy loading, hooks, cache, validações
  • Integração wbjdbc-wborm

📜 Licença

Este projeto é licenciado sob a Licença MIT. Consulte o arquivo LICENSE para mais informações.


🤝 Contribuindo

Pull requests são bem-vindos! Envie sugestões ou melhorias diretamente no repositório do GitHub.

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

wborm-0.1.8.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

wborm-0.1.8-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file wborm-0.1.8.tar.gz.

File metadata

  • Download URL: wborm-0.1.8.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wborm-0.1.8.tar.gz
Algorithm Hash digest
SHA256 b655e226dc77a0f0e51a45e0fe686025e2262316b998b108eb052a4c6df75524
MD5 ad0471076214c0a03f157936d8b52dd4
BLAKE2b-256 9ad958f90c38dce12c637450e8abfee5abd7ce5b8566516587a1f79b3ac698d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for wborm-0.1.8.tar.gz:

Publisher: publish-package.yml on wanderbatistaf/wborm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wborm-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: wborm-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for wborm-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fba045c75d9bad2a51ddcf32a642ba098371b547c8430d4fcde2ac745041c675
MD5 023830ecc89164ea087f59d097625095
BLAKE2b-256 dad5085847a7c18338643f10a58d96f9275bac3ba8a98617dff08dbc0026908f

See more details on using hashes here.

Provenance

The following attestation bundles were made for wborm-0.1.8-py3-none-any.whl:

Publisher: publish-package.yml on wanderbatistaf/wborm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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