[GIS] How to create a PostGIS layer using QGIS API

postgisqgis

I want to create a new PostGIS layer and save changes made to it.

Presently, I am connecting Python to PostGIS using psycopg2 but I want to know whether there is any QGIS API function available.

Note: I am able to open an existing PostGIS layer, but I don't know how to create a new one.

Best Answer

"How to create a postgis PostGIS layer in qgis" > You could have been more clear before! It took time to me to write my first answer (deleted since).

You can have a look on that online workshop and particularly on that section.

I guess you already know the QGIS api doc!