[Qgis-developer] Problems importing layers to SpatiaLite database

Christophe Damour sigeal at sigeal.com
Thu Apr 7 05:53:20 PDT 2016


Hi,

Sorry for double posting, but my first message is waiting for moderation 
because of attach file size...

I am trying to import a PostGis layer into a SpatiaLite database, using 
QGIS Database Manager import function.

The PostGis layer has a string primary key, and I want to keep that 
primary key.

To keep the primary key, I check "Primary key" option and type the name 
of the PostGis primary key field, but the result is an empty column...
I tried to workaround this problem by keeping primary key values in a 
second column and getting them back after the import, this used to work 
with QGIS V2.8, but doesn't anymore with QGIS V2.14.

Here is the result I get :
- When opened in QGIS Database Manager, I can see correct values in the 
id column.
- When opened in QGIS, every record has the same id value.

So my questions are :
- Why isn't it possible to keep PostGis primary key when importing to 
SpatiaLite with QGIS Database Manager ?
- How to workaround this problem ?

Thank you for helping,

-- 
Christophe

Le 07/04/2016 à 14:01, Christophe Damour a écrit :
> Hi,
>
> I am trying to import a PostGis layer into a SpatiaLite database, 
> using QGIS Database Manager import function.
>
> The PostGis layer has a string primary key, and I want to keep that 
> primary key.
>
> To keep the primary key, I check "Primary key" option and type the 
> name of the PostGis primary key field, but the result is an empty 
> column...
> I tried to workaround this problem by keeping primary key values in a 
> second column and getting them back after the import, this used to 
> work with QGIS V2.8, but doesn't anymore with QGIS V2.14.
>
> Attached to this message is an example SpatiaLite database that 
> illustrates the result I get :
> - When opened in QGIS Database Manager, I can see correct values in 
> the id column.
> - When opened in QGIS, every record has the same id value.
>
> So my questions are :
> - Why isn't it possible to keep PostGis primary key when importing to 
> SpatiaLite with QGIS Database Manager ?
> - How to workaround this problem ?
>
> Thank you for helping,
> -- 
> Christophe
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160407/64c6dcf9/attachment.html>


More information about the Qgis-developer mailing list