News for hackers. Stuff that matters.
Re:PostgREST 9.0 by bb88 on Tuesday November 30, 2021 @11:33AM (#29393935)

    class PG:
        _pg_conn = None

        @classmethod
        def pg(cls):
            if cls._pg_conn is None:
                cls._pg_conn = psycopg2.connect(...)
            return cls._pg_conn


    connection = PG.pg()
Re:PostgREST 9.0 by michelpp on Tuesday November 30, 2021 @02:13PM (#29396168)
Another approach would be to use a lazy property:

https://pypi.org/project/lazy-property/

Re:PostgREST 9.0 by bb88 on Thursday December 02, 2021 @04:37PM (#29423019)
I've seen that. I wish it were in the standard library though.