Call python machine learning model from UDF or SP
You have basically three options:


Have a program written in Python, that uses PsycoPG, PyGreSQL or some other driver with equivalent functionality to get the data out of PostgreSQL and process it in Python.  Or you could use some toolkit like SQLAlchemy, which works as an Object Relational Mapper.
Write a User Defined Function using PL/Python, which means you actually write UDFs within PostgreSQL using the Python language. If your model works with a certain function model_predict(a, b, c), you can call it in a fashion similar to:

SELECT a, b, c, model_predict(a, b, c) AS prediction
   FROM table
  WHERE &lt;condition&gt;
Export the data from PostgreSQL (with COPY FROM ..., or using any tool such as pgAdmin), into a suitable format (such as CSV), and then import it and process in Python (you could use Pandas read csv, e.g.).