Skip to main content

A Python library for defining and applying column functions to DuckDB tables

Project description

Deductable

de-duck-table A way to deduce new columns in your duckdb table

Description

For a client I was doing research on a collection of websites. I wanted an easy way to add a column with findings based on the previous information. For instance, I started with a list of names, for which i didn't have the URL. An agent took in the name, and found the website url.

Installation

uv pip install deductable

Requirements

  • Python 3.13+
  • DuckDB 1.4.1+
  • Loguru 0.7.3+
  • Pandas 2.3.3+

Quick Start

from typing import Optional
import duckdb
from deductable import Deductable
from my_agents import find_url

# Connect to a DuckDB database
with duckdb.connect('companies.duckdb') as con:
    # Create a Deductable instance for the table
    # Deductable expects at least an id column
    dt = Deductable(con, table_name="companies")

    @dt.column
    def company_url(company_name: str) -> Optional[float]:
        # company_name should be a column in the duckdb
        return find_url(company_name)

    # Apply the column function to populate the weight column
    dt.materialize()

    # View the result
    print(dt.df())

Features

  • Type-safe column functions: Define column functions with proper type annotations
  • Automatic column creation: Columns are automatically created based on function names
  • Dependency handling: Functions can depend on other columns
  • Optional values: Support for nullable columns with Optional type annotations
  • Pandas integration: Easy conversion to pandas DataFrames

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

deductable-2025.10.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

deductable-2025.10.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file deductable-2025.10.1.tar.gz.

File metadata

  • Download URL: deductable-2025.10.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for deductable-2025.10.1.tar.gz
Algorithm Hash digest
SHA256 665a8dacf5542ba0fdb4f645257378cef64a81f4b61cf804e3af2b08470c9e84
MD5 9aae150f221cbf867200786629211126
BLAKE2b-256 aed7d339e14c41ead53ccb674258de457063928789bfe7d92c742a9bcd8cabe0

See more details on using hashes here.

File details

Details for the file deductable-2025.10.1-py3-none-any.whl.

File metadata

File hashes

Hashes for deductable-2025.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df3be0afa1db4dc5a14cf5781ef7a261850c96cbddc8b0a0825ce7b4e455a9be
MD5 0c6844c1f743827c570f4ebb75651326
BLAKE2b-256 b44fd7eb06a647b84e5ec36556945f443e59beb5ee1500c203e08e67c0acfe05

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