Is it possible to directly use fields from a remote PostgreSQL server's database to create template mail-merge documents in LibreOffice? I am trying to make it easy to define a document with fields from the database so that, for example, bills, letters, and notifications could be printed for up to several thousand people at a time.

I know LibreOffice supports inserting fields from a "database," but you have to locate the actual database file which isn't a realistic task in PostgreSQL.

Perhaps the best way of accomplishing this is by using a python script that connects to the remote database and fetches the needed information, but I would prefer, if at all possible, to do this in the most native LibreOffice way possible.