#159 ✓ invalid
John Woltman

LTree support

Reported by John Woltman | May 1st, 2013 @ 07:49 PM

I have been using psycopg for awhile now, and it's great. I was wondering if support could be added for Postgresql's LTree data type, which can be used to store hierarchies as a field in the database. If the psycopg team does not have time for this feature, I would gladly help implement it if someone can point me in the right direction.

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo May 1st, 2013 @ 08:49 PM

    I heavily use ltrees with psycopg (they are just amazing). I use them just as strings. What do you need to implement? They are read-written ok as string, and because the strict rules about the ltree path components you can safely use str.split('.') to tokenize them.

    What kind of feature would you implement for an ltree object in python? I suspect an overly specialized object wouldn't add much.

  • John Woltman

    John Woltman May 2nd, 2013 @ 06:24 PM

    I did not realize that ltrees are treated as strings so easily. My end-goal was to implement an LTree object for Django, and I thought that Psycopg would need to have special support for it as well. But since ltrees can be used as strings, Psycopg support isn't necessary.

    From the Django point-of-view, I'll be adding things like childOf, parentOf, etc. methods, but that is a Django thing, and not Pyscopg-specific.

  • Daniele Varrazzo

    Daniele Varrazzo May 2nd, 2013 @ 06:31 PM

    • State changed from “new” to “invalid”

    Yes, I think you won't need anything special from psycopg. If you did, feel free to reopen the ticket.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Pages