scylladb / scylladb/python-rs-driver

UDT deserialization: default to attribute-accessible rows, and add a `register_user_type`-equivalent

Open
#163 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6
Forks
7
Avg merge
5d 13h
Merged PRs (30d)
9

Description

Background: in cassandra-driver, UDT columns are never plain dicts. By default, UserType.make_udt_class()
(cassandra/cqltypes.py:976-1010) auto-generates a namedtuple per UDT from its schema (field names come
from CREATE TYPE), giving attribute access (row.location.street) with zero configuration.

On top of that, Cluster.register_user_type(keyspace, udt_name, klass) (cassandra/cluster.py:1639-1692)
lets a user map a UDT to their own class — both directions: binding a query parameter of that UDT
expects an instance of klass, and result rows for that UDT come back as klass instances. It's a global
registry keyed by (keyspace, udt_name), cached and invalidated on re-registration.

Needs to be implemented:

  1. Change the default UDT representation from plain dict to something attribute-accessible (a
    namedtuple-like object generated from the UDT's schema, matching the old driver's zero-config
    default), so .field access works out of the box without any registration step.
  2. Expose a register_user_type-equivalent — a way to map a given UDT (by keyspace + name) to a
    user-supplied Python class, used both when binding parameters of that UDT and when deserializing
    result rows containing it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the behavioral references in cassandra/cqltypes.py and cassandra/cluster.py, especially UserType.make_udt_class() and Cluster.register_user_type(). Then locate the corresponding UDT binding and result-row deserialization entry points in this repository. Done means default UDTs support attribute access without registration and a user class is honored in both directions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.