coplin-db2
A biblioteca coplin-db2 é um módulo de conveniência para acessar bancos de dados do tipo IBM DB2, desenvolvido pela Coordenadoria de Planejamento Informacional da UFSM (COPLIN).
Com esta biblioteca, é possível definir um arquivo com credenciais de acesso ao banco de dados, no formato json, que
podem ser utilizadas posteriormente:
Arquivo credentials.json:
{
"user": "nome_de_usuário",
"password": "sua_senha_aqui",
"host": "URL_do_host",
"port": 50000,
"database": "nome_do_banco"
}
Arquivo db2_schema.sql:
CREATE TABLE USERS_TEST_IBMDB2(
ID INTEGER NOT NULL PRIMARY KEY,
NAME VARCHAR(10) NOT NULL,
AGE INTEGER NOT NULL
);
INSERT INTO USERS_TEST_IBMDB2(ID, NAME, AGE) VALUES (1, 'HENRY', 32);
INSERT INTO USERS_TEST_IBMDB2(ID, NAME, AGE) VALUES (2, 'JOHN', 20);
Arquivo main.py:
import os
from db2 import DB2Connection
# arquivo JSON com credenciais de login para o banco de dados
credentials = 'credentials.json'
with DB2Connection(credentials) as db2_conn:
db2_conn.create_tables('db2_schema.sql')
query_str = '''
SELECT *
FROM USERS_TEST_IBMDB2;
'''
df = db2_conn.query_to_dataframe(query_str)
print(df)
# deleta a tabela
# db2_conn.modify('''DROP TABLE USERS_TEST_IBMDB2;''', suppress=False)
A saída esperada deve ser:
ID NAME AGE
0 1 HENRY 32
1 2 JOHN 20
Instalação
Para instalar o pacote pelo pip, digite o seguinte comando:
pip install coplin-db2
Documentação
A documentação está disponível em https://coplin-ufsm.github.io/db2
Desenvolvimento
Para instruções de desenvolvimento do pacote, consulte este arquivo.
Contato
Biblioteca desenvolvida originalmente por Henry Cagnini: henry.cagnini@ufsm.br
Caso encontre algum problema no uso, abra um issue no repositório da biblioteca.
Pull requests são bem-vindos!
Metadata
Release files for coplin-db2 2.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| coplin_db2-2.5.3.tar.gz | 9.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| coplin_db2-2.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.9 kB
Release files / coplin_db2-2.5.3.tar.gz
| Download URL | coplin_db2-2.5.3.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
671f94710413f02af4714daa71ce38da7ef04cb5f5068b5954ad8882d8ef960a
|
|
BLAKE2b-256 checksum How to use checksums |
1e696418cc0bf3716b716633c0c5b8dafa9f0bce2e969dac6b5702666c429c48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 23, 2026.
Transparency logRelease files / coplin_db2-2.5.3-py3-none-any.whl
| Download URL | coplin_db2-2.5.3-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
42dba45c2b3f9f2e9c6552ceba1fc6c1c18fad375892684fb43714362183abca
|
|
BLAKE2b-256 checksum How to use checksums |
bc9806aa63dc1b8f0d32af488073196be31ff951a403f4900217ce4fec1f3b40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 23, 2026.
Transparency log