librelist archives

« back to archive

pysqlite

pysqlite

From:
Jude Mwenda
Date:
2011-03-17 @ 11:54
Hi,
I would like to use some of geodjango's functions on my intance. On adding
at the installed apps 'django.contrib.gis' i get the error
Only versions of pysqlite 2.5+ are compatible with SpatiaLite and GeoDjango.
Any pointers on how to upgrade pysqlite to 2.5+? or is there an alternative
to doing geometry functions saved on the sqlite database? such as extent()

Regards

Re: [geonode] pysqlite

From:
Alex Mandel
Date:
2011-03-17 @ 22:40
On 03/17/2011 04:54 AM, Jude Mwenda wrote:
> Hi,
> I would like to use some of geodjango's functions on my intance. On adding
> at the installed apps 'django.contrib.gis' i get the error
> Only versions of pysqlite 2.5+ are compatible with SpatiaLite and GeoDjango.
> Any pointers on how to upgrade pysqlite to 2.5+? or is there an alternative
> to doing geometry functions saved on the sqlite database? such as extent()
> 
> Regards
> 

I can answer your original question. The problem is that the default
sqlite lib in python ships with load extensions disabled.
You need to install pysqlite from source and change one flag before
installing it.
Download the source:
Edit setup.cfg

comment out (ADD # at the beginning of this line)
define=SQLITE_OMIT_LOAD_EXTENSION

The run python setup.py install

That should solve the issue, Geodjango knows to look for pysqlite
installed aside from the built in connector.

Thanks,
Alex

Re: [geonode] pysqlite

From:
Jeff Johnson
Date:
2011-03-17 @ 16:50
It seems like it may be easier to use PostGIS for this? I've never had
much luck with spatialite and GeoDjango, but its been a while since I
have tried, and I think its become easier, but your issue indicates
maybe not?

Jeff

On Thu, Mar 17, 2011 at 4:54 AM, Jude Mwenda <jude@upande.com> wrote:
> Hi,
> I would like to use some of geodjango's functions on my intance. On adding
> at the installed apps 'django.contrib.gis' i get the error
> Only versions of pysqlite 2.5+ are compatible with SpatiaLite and GeoDjango.
> Any pointers on how to upgrade pysqlite to 2.5+? or is there an alternative
> to doing geometry functions saved on the sqlite database? such as extent()
> Regards

Re: [geonode] pysqlite

From:
Jude Mwenda
Date:
2011-03-17 @ 16:57
Any clue on migrating including data from sqlite to postgis?

2011/3/17 Jeff Johnson <jjohnson@opengeo.org>

> It seems like it may be easier to use PostGIS for this? I've never had
> much luck with spatialite and GeoDjango, but its been a while since I
> have tried, and I think its become easier, but your issue indicates
> maybe not?
>
> Jeff
>
> On Thu, Mar 17, 2011 at 4:54 AM, Jude Mwenda <jude@upande.com> wrote:
> > Hi,
> > I would like to use some of geodjango's functions on my intance. On
> adding
> > at the installed apps 'django.contrib.gis' i get the error
> > Only versions of pysqlite 2.5+ are compatible with SpatiaLite and
> GeoDjango.
> > Any pointers on how to upgrade pysqlite to 2.5+? or is there an
> alternative
> > to doing geometry functions saved on the sqlite database? such as
> extent()
> > Regards
>

Re: [geonode] pysqlite

From:
Jeff Johnson
Date:
2011-03-17 @ 17:16
Yep, I just did this the other day on the demo server ... Get your
database setup and working, use the django management command to dump
and load the data into the other database and off you go.

http://docs.djangoproject.com/en/dev/ref/django-admin/

dumpdata and loaddata are the 2 commands.

The exact sequence is like this. I used 2 local settings files and
specified which one to use on the command line

1) Stand up new DB (install postgres, postgis etc)
2) Create the DB user and DB
3) Activate virtualenv
4) django-admin.py syncdb --settings=new_local_settings.py
5) django-admin.py dumpdata --settings=local_settings.py > geonode_data.json
6) django-admin.py loaddata geonode_data.json --settings=new_local_settings.py
7) mv local_settings.py local_settings_bkup.py
8) mv new_local_settings.py local_settings.py
9) restart apache to pick up the changes

I did run into some issues with the fixtures not being generated in
the right sequence, so received errors about trying to add layers with
an non-existent owner. Basically had to do the dump/load data with the
users first and then with the rest of the DB.

Lemme know if that works for you.

Jeff

On Thu, Mar 17, 2011 at 9:57 AM, Jude Mwenda <jude@upande.com> wrote:
> Any clue on migrating including data from sqlite to postgis?
>
> 2011/3/17 Jeff Johnson <jjohnson@opengeo.org>
>>
>> It seems like it may be easier to use PostGIS for this? I've never had
>> much luck with spatialite and GeoDjango, but its been a while since I
>> have tried, and I think its become easier, but your issue indicates
>> maybe not?
>>
>> Jeff
>>
>> On Thu, Mar 17, 2011 at 4:54 AM, Jude Mwenda <jude@upande.com> wrote:
>> > Hi,
>> > I would like to use some of geodjango's functions on my intance. On
>> > adding
>> > at the installed apps 'django.contrib.gis' i get the error
>> > Only versions of pysqlite 2.5+ are compatible with SpatiaLite and
>> > GeoDjango.
>> > Any pointers on how to upgrade pysqlite to 2.5+? or is there an
>> > alternative
>> > to doing geometry functions saved on the sqlite database? such as
>> > extent()
>> > Regards
>
>

Re: [geonode] pysqlite

From:
Jeff Johnson
Date:
2011-03-17 @ 17:17
Should have noted that you need to create the new_local_settings.py as
an exact copy of the existing local_settings.py and modify the
database params to point to the postgres DB.

Jeff

On Thu, Mar 17, 2011 at 10:16 AM, Jeff Johnson <jjohnson@opengeo.org> wrote:
> Yep, I just did this the other day on the demo server ... Get your
> database setup and working, use the django management command to dump
> and load the data into the other database and off you go.
>
> http://docs.djangoproject.com/en/dev/ref/django-admin/
>
> dumpdata and loaddata are the 2 commands.
>
> The exact sequence is like this. I used 2 local settings files and
> specified which one to use on the command line
>
> 1) Stand up new DB (install postgres, postgis etc)
> 2) Create the DB user and DB
> 3) Activate virtualenv
> 4) django-admin.py syncdb --settings=new_local_settings.py
> 5) django-admin.py dumpdata --settings=local_settings.py > geonode_data.json
> 6) django-admin.py loaddata geonode_data.json --settings=new_local_settings.py
> 7) mv local_settings.py local_settings_bkup.py
> 8) mv new_local_settings.py local_settings.py
> 9) restart apache to pick up the changes
>
> I did run into some issues with the fixtures not being generated in
> the right sequence, so received errors about trying to add layers with
> an non-existent owner. Basically had to do the dump/load data with the
> users first and then with the rest of the DB.
>
> Lemme know if that works for you.
>
> Jeff
>
> On Thu, Mar 17, 2011 at 9:57 AM, Jude Mwenda <jude@upande.com> wrote:
>> Any clue on migrating including data from sqlite to postgis?
>>
>> 2011/3/17 Jeff Johnson <jjohnson@opengeo.org>
>>>
>>> It seems like it may be easier to use PostGIS for this? I've never had
>>> much luck with spatialite and GeoDjango, but its been a while since I
>>> have tried, and I think its become easier, but your issue indicates
>>> maybe not?
>>>
>>> Jeff
>>>
>>> On Thu, Mar 17, 2011 at 4:54 AM, Jude Mwenda <jude@upande.com> wrote:
>>> > Hi,
>>> > I would like to use some of geodjango's functions on my intance. On
>>> > adding
>>> > at the installed apps 'django.contrib.gis' i get the error
>>> > Only versions of pysqlite 2.5+ are compatible with SpatiaLite and
>>> > GeoDjango.
>>> > Any pointers on how to upgrade pysqlite to 2.5+? or is there an
>>> > alternative
>>> > to doing geometry functions saved on the sqlite database? such as
>>> > extent()
>>> > Regards
>>
>>
>

Re: [geonode] pysqlite

From:
Spanring, Christian
Date:
2011-03-17 @ 17:12
In my experience, the easiest way is to migrate data in Django is to use fixtures.

E.g.
manage.py dumpdata 
http://docs.djangoproject.com/en/1.2/ref/django-admin/#dumpdata-appname-appname-appname-model
and
manage.py loaddata 
http://docs.djangoproject.com/en/1.2/ref/django-admin/#loaddata-fixture-fixture

Christian

From: geonode@librelist.com [mailto:geonode@librelist.com] On Behalf Of 
Jude Mwenda
Sent: Thursday, March 17, 2011 12:58 PM
To: geonode@librelist.com
Subject: Re: [geonode] pysqlite

Any clue on migrating including data from sqlite to postgis?
2011/3/17 Jeff Johnson <jjohnson@opengeo.org<mailto:jjohnson@opengeo.org>>
It seems like it may be easier to use PostGIS for this? I've never had
much luck with spatialite and GeoDjango, but its been a while since I
have tried, and I think its become easier, but your issue indicates
maybe not?

Jeff

On Thu, Mar 17, 2011 at 4:54 AM, Jude Mwenda 
<jude@upande.com<mailto:jude@upande.com>> wrote:
> Hi,
> I would like to use some of geodjango's functions on my intance. On adding
> at the installed apps 'django.contrib.gis' i get the error
> Only versions of pysqlite 2.5+ are compatible with SpatiaLite and GeoDjango.
> Any pointers on how to upgrade pysqlite to 2.5+? or is there an alternative
> to doing geometry functions saved on the sqlite database? such as extent()
> Regards


________________________________
Please be advised that the Massachusetts Secretary of State considers 
e-mail to be a public record, and therefore subject to the Massachusetts 
Public Records Law, M.G.L. c. 66 ? 10.