scylladb / scylladb/python-rs-driver
UDT deserialization: default to attribute-accessible rows, and add a `register_user_type`-equivalent
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:
- Change the default UDT representation from plain
dictto something attribute-accessible (a
namedtuple-like object generated from the UDT's schema, matching the old driver's zero-config
default), so.fieldaccess works out of the box without any registration step. - 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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