How it is possible save qgis project to GeoPackage in PyQGIS?

enter image description here

the image is user interface but I need in code

1 Answer 1


You need to construct a URI like this:

uri = 'geopackage:/path/to/db.gpkg?projectName=my_gpgk_project'

And then use it to save the project, in this way:

  • Thanks that's worked, and do you have any idea where can I found documentation about this ? Commented Jul 21, 2020 at 15:30
  • 1
    Actually, not. But, GIS.SE is also a source of documentation. In fact, many answers provided here are later copied to official documentation sources. Of course, you always have the source code available, which, when programming, may be seen as the best documentation source (think about code comments and unit tests) at all. Commented Jul 21, 2020 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.