Обсуждение: python modul pre-import to avoid importing each time

Поиск
Список
Период
Сортировка

python modul pre-import to avoid importing each time

От
Rémi Cura
Дата:
Hey List,
this is a repost from the general list where it get no responses (5 days)

I use plpython with postgis and 2 python modules (numpy and shapely).
Sadly importing such module in the plpython function is very slow (about half a second).

I also don't know if this overhead is applied each time the function is called in the same session.

Is there a way to pre-import those modules once and for all (at server start up for example),
such that the python function are accelerated?

Thanks,

Cheers,
Rémi-C