Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

LTree support

#159

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.

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

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo

    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.

    May 1st, 2013 @ 08:49 PM

  2. John Woltman
    John Woltman

    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.

    May 2nd, 2013 @ 06:24 PM

  3. Daniele Varrazzo
    Daniele Varrazzo
    • 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.

    May 2nd, 2013 @ 06:31 PM