Skip to main content

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

Project description

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: wborm-0.1.7.tar.gz
  • Upload date:
  • Size: 9.5 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.7.tar.gz
Algorithm Hash digest
SHA256 ae1064eb28fdbf58b021b134c289afbcc7ef81e8cceb66a728e16a29a970fe8e
MD5 8f22dd6b99e0ba57d34a700de4cb081f
BLAKE2b-256 34261cc0bc5d71f4a01bf20e651c1ab58c2bd42f1fbeed50a15866e7798f52ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for wborm-0.1.7.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.7-py3-none-any.whl.

File metadata

  • Download URL: wborm-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 f32069064161ef15c356be4fc2734b8cc790bb37e498b55f2a1bcf745adeb666
MD5 dd12d0c3b7da3eb0da0066cdb778b116
BLAKE2b-256 d5db2f9a2e1e13e4aab7158b671c263b5b9ded067c659f0024420fe77fa22adf

See more details on using hashes here.

Provenance

The following attestation bundles were made for wborm-0.1.7-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