Skip to main content

Upsert Pandas

Repo PyPI - Version
Read the Docs Publish Python to PyPI

A função Upsert é uma operação fundamental em bancos de dados e sistemas de gerenciamento de dados que combina as operações de Update (Atualizar) e Insert (Inserir) em uma única etapa atômica. O nome Upsert é, literalmente, uma junção dos dois verbos.



Objetivo da Função Upsert

O principal objetivo do upsert é garantir que os dados de uma fonte de origem sejam sincronizados de forma eficiente com uma tabela de destino, sem gerar erros de duplicidade nas chaves primárias.

Ela funciona verificando a existência de um registro com base em uma Chave de Negócio (ou Chave Primária):

  • SE o registro EXISTE na tabela de destino (match na chave): Atualiza (Update) as colunas do registro existente com os novos valores da fonte de origem.

  • SE o registro NÃO EXISTE na tabela de destino (não há match na chave): Insere (Insert) o novo registro na tabela de destino.



Cenários de Uso Comuns

O Upsert é amplamente utilizado em Engenharia de Dados, ETL/ELT e Data Warehousing:

  • Sincronização de Dados: É a base para manter tabelas de dimensão em Data Warehouses atualizadas, garantindo que novos clientes sejam inseridos e que os dados de clientes existentes (como endereço ou nome) sejam corrigidos.
  • Processamento de Streams: Em sistemas de processamento em tempo real (como Apache Kafka ou Flink), o Upsert é usado para garantir que o estado de uma entidade seja consistentemente atualizado, tratando eventos novos ou modificações.
  • Pandas/PySpark: Em ambientes como PySpark (com Delta Lake) ou Pandas, a lógica Upsert é implementada para fundir (merge) DataFrames de forma eficiente.

Metadata

Release files for upsert-pandas 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for upsert-pandas 0.0.4
File Size Uploaded
upsert_pandas-0.0.4.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for upsert-pandas 0.0.4
File Interpreter ABI Platform
upsert_pandas-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / upsert_pandas-0.0.4.tar.gz

Download URL upsert_pandas-0.0.4.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
edfd91e4ee46c26660bb44c059ece9a5978617cd89a80a267bb514d83f7eafa4
BLAKE2b-256 checksum
How to use checksums
8cb3f5ce28e9ecbf8041a68890231e7a0a1d2a5dac8884f9d2b8ea9d12593e5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / upsert_pandas-0.0.4-py3-none-any.whl

Download URL upsert_pandas-0.0.4-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
49f40396f602610abf47d2b4ee54b5ceeb18da7026ff532016c2fdde380d960e
BLAKE2b-256 checksum
How to use checksums
f8880a31eea56176c25452cb616c23854aed1a8c6631921f3f49fc1910e5459f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page