Skip to main content

Funciones con conexiones a bases de datos

Project description

ojitos369 (General)

REPO: https://github.com/Ojitos369/ojitos369-pip

Databases

MySQL

from ojitos369_mysql_db.mysql_db import ConexionMySQL

db_data = {
    'user': 'your_db_user',
    'password': 'your_db_password',
    'host': 'your_db_host',
    'scheme': 'your_scheme_name',
}
conexion = ConexionMySQL(db_data)

conexion.consulta(query, params=None) # return a list of list with the result of the query
# >> [["ojitos369", 18], ["ojitos369", 18]]
conexion.consulta_asociativa(query, params=None) # return a list of dict with the result of the query
# >> [{"name": "ojitos369", "age": 18}, {"name": "ojitos369", "age": 18}]
conexion.ejecutar(query, parametros = None) # execute transaction prepared with preparar_transaccion
# >> Bool

conexion.paginador(query, registros_pagina = 1, pagina = 2, params = None) # return de n resutls of query
# >> {
# >>     'registros': [{"name": "ojitos369", "age": 18, "rnum": 2}],
# >>     'num_registros': 2,
# >>     'paginas': 2,
# >>     'pagina': 2,
# >> }

conexion.commit() # commit transaction
conexion.rollback() # rollback transaction
conexion.close() # close connection

```# ojitos369_mysql_db
# ojitos369_mysql_db

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

ojitos369_postgres_db-1.2.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

ojitos369_postgres_db-1.2.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file ojitos369_postgres_db-1.2.1.tar.gz.

File metadata

  • Download URL: ojitos369_postgres_db-1.2.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ojitos369_postgres_db-1.2.1.tar.gz
Algorithm Hash digest
SHA256 49c6649c6fd61dccc1952fd8d9d51fc642b615eb548f26ac3cfb5de5f22cdd20
MD5 079f8c22504bba2d1ec067768922be9d
BLAKE2b-256 e2e343b22e55f89c08027d4a3de7f24a3663ab8712617194442a8a4bd4bccc0b

See more details on using hashes here.

File details

Details for the file ojitos369_postgres_db-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ojitos369_postgres_db-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3f978283c8f9450327472f6f4c4584bb9276961c29bc0918818d6dc0a4868f5
MD5 33300d115743ddf22be67a86b195e9a4
BLAKE2b-256 9b1c6f85c09ff69739d640e5cf7be4f82e91ee4545c562a90149d62f9677462a

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