Postgresql Create Replace Function In Python Dictionary Append