Thank you.
Is there a reason why connect() must get the empty string as parametr, please?
On Tue, Mar 09, 2021 at 12:44:27PM +0100, Daniele Varrazzo wrote:
It does: connect("", **parse_dsn())
-- Daniele
eg 1, 1059 CM Amsterdam, The Netherlands
On Tue, Mar 9, 2021 at 11:45 AM Hans Ginzel wrote:
Please, there should be a possibility to call connect() without parameters
for connecting using environment variables (PGSERVICE, PGDATABASE,…)
or defaults ($USER@localhost/postgres).
Even pg uri post
Please, there should be a possibility to call connect() without parameters
for connecting using environment variables (PGSERVICE, PGDATABASE,…)
or defaults ($USER@localhost/postgres).
Even pg uri postgres:// is valid,
https://www.postgresql.org/docs/current/libpq-connect.html.
d = psycopg2.conn
On Wed, Mar 03, 2021 at 03:23:28PM -0800, Adrian Klaver wrote:
On 3/3/21 1:51 PM, Hans Ginzel wrote:
You need to do something like:
cur.execute(sql.SQL("INSERT INTO test_default VALUES ({})").format(DEFAULT))
Formating values into SQL statement is done by the execute(), isn't
How to insert DEFAULT value, please?
import psycopg2
from psycopg2.sql import DEFAULT#
https://www.postgresql-archive.org/Inserting-default-values-into-execute-values-td6130148.html
db = psycopg2.connect(host='host', dbname='db')
cursor = db.cursor()
cursor.execute("DROP TABLE IF EXISTS
On Mon, Jul 13, 2020 at 05:15:19PM +0100, Daniele Varrazzo wrote:
You can use a partial function for instance, of the like of: `lambda
obj: Json(obj, dumps=mydumps)`.
Thank you, Daniele.
I have (succesfully) tried
from psycopg2.extras import Json
from json import JSONEncoder
from bson import O
Hello,
how can I register an adapter with custom JSONEncoder, please.
On Stack Overflow, https://stackoverflow.com/a/55939024/2556118
I have found to use Json class
psycopg2.extensions.register_adapter(dict, psycopg2.extras.Json).
But I need to use custom JSONEncoder because of bson.ObectId typ