How to connect to database of 3rd app (postgres) to get data then update to doctype of frappe

i want to connect to database of other application then get data and push it into mariaDB ( doctype)
Can I use built in functions to connect database and query frappe’s db.

this is my current code with self connect db

I haven’t tried this myself, but I bookmarked these pages (in case I had the need).

Virtual docType can use an external source for the data.

MongoDB powered docTypes might be translatable to postgres.