[GeoNode-devel] GeoNode Backup and Restore ... any clue on DJango serialization?

Paolo Corti pcorti at gmail.com
Fri Jan 22 09:00:09 PST 2016


Hi Alessio
Try to dump both base and layers applications to the same json file
and then restore from there
cheers
p

On Fri, Jan 22, 2016 at 11:38 AM, Alessio Fabiani
<alessio.fabiani at geo-solutions.it> wrote:
> Taking a look into the logs, the first JSON is correct. The issue is on the
> reloading of the base_contactrole dependency.
>
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/NWWaa2 for more information.
> ==
>
> Ing. Alessio Fabiani
> @alfa7691
> Founder/Technical Lead
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax:     +39 0584 1660272
> mob:   +39  331 6233686
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
>
> Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i
> file/s allegato/i sono da considerarsi strettamente riservate. Il loro
> utilizzo è consentito esclusivamente al destinatario del messaggio, per le
> finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio
> senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia
> via e-mail e di procedere alla distruzione del messaggio stesso,
> cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo
> anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per
> finalità diverse, costituisce comportamento contrario ai principi dettati
> dal D.Lgs. 196/2003.
>
>
>
> The information in this message and/or attachments, is intended solely for
> the attention and use of the named addressee(s) and may be confidential or
> proprietary in nature or covered by the provisions of privacy act
> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
> Code).Any use not in accord with its purpose, any disclosure, reproduction,
> copying, distribution, or either dissemination, either whole or partial, is
> strictly forbidden except previous formal approval of the named
> addressee(s). If you are not the intended recipient, please contact
> immediately the sender by telephone, fax or e-mail and delete the
> information in this message that has been received in error. The sender does
> not give any warranty or accept liability as the content, accuracy or
> completeness of sent messages and accepts no responsibility  for changes
> made after they were sent or for other risks which arise as a result of
> e-mail transmission, viruses, etc.
>
>
> On Fri, Jan 22, 2016 at 5:26 PM, Alessio Fabiani
> <alessio.fabiani at geo-solutions.it> wrote:
>>
>> Dear list,
>> working on the GeoNode Backup and Restore task I'm struggling with an
>> issue while trying to deserialize data.
>>
>> Basically what I'm trying to do is dump the GeoNode fixtures as JSON files
>> and trying to load them later on an empty (prepared) GeoNode DB.
>>
>> Now ... by playing a bit with the json outputs and load order I am able to
>> restore almost all the fixtures, but I have an issue with the Layers,
>> inherited from ResourceBases.
>>
>> I am able to restore succesfully the ResourceBases but whenever I try to
>> deserialize a Layer I'm getting and error with the primary key.
>>
>> Using the default JSON like this:
>>
>> [
>> {
>>   "pk": 1,
>>   "model": "layers.layer",
>>   "fields": {
>>     "styles": [
>>       1
>>     ],
>>     "store": "datastore",
>>     "name": "san_andres_y_providencia_administrative",
>>     "service": null,
>>     "charset": "UTF-8",
>>     "title_en": "San Andres Y Providencia Administrative",
>>     "abstract_en": "No abstract provided",
>>     "regions": [],
>>     "typename": "geonode:san_andres_y_providencia_administrative",
>>     "default_style": null,
>>     "purpose_en": null,
>>     "workspace": "geonode",
>>     "upload_session": 9,
>>     "supplemental_information_en": "No information provided",
>>     "data_quality_statement_en": null,
>>     "storeType": "dataStore",
>>     "distribution_description_en": null,
>>     "constraints_other_en": null
>>   }
>> }
>> ]
>>
>> I get an error message like: null violates constraint for "resource_id"
>>
>> If I try to modify the JSON like this:
>>
>> [
>> {
>>   "resourcebase_ptr_id": 1,
>>   "model": "layers.layer",
>>   "fields": {
>>     "styles": [
>>       1
>>     ],
>>     "store": "datastore",
>>     "name": "san_andres_y_providencia_administrative",
>>     "service": null,
>>     "charset": "UTF-8",
>>     "title_en": "San Andres Y Providencia Administrative",
>>     "abstract_en": "No abstract provided",
>>     "regions": [],
>>     "typename": "geonode:san_andres_y_providencia_administrative",
>>     "default_style": null,
>>     "purpose_en": null,
>>     "workspace": "geonode",
>>     "upload_session": 9,
>>     "supplemental_information_en": "No information provided",
>>     "data_quality_statement_en": null,
>>     "storeType": "dataStore",
>>     "distribution_description_en": null,
>>     "constraints_other_en": null
>>   }
>> }
>> ]
>>
>> I get the following error:
>>
>> ResourceBase matching query does not exist.
>>
>> Any idea/help ?
>>
>> ==
>> GeoServer Professional Services from the experts! Visit
>> http://goo.gl/NWWaa2 for more information.
>> ==
>>
>> Ing. Alessio Fabiani
>> @alfa7691
>> Founder/Technical Lead
>>
>> GeoSolutions S.A.S.
>> Via Poggio alle Viti 1187
>> 55054  Massarosa (LU)
>> Italy
>> phone: +39 0584 962313
>> fax:     +39 0584 1660272
>> mob:   +39  331 6233686
>>
>> http://www.geo-solutions.it
>> http://twitter.com/geosolutions_it
>>
>> -------------------------------------------------------
>>
>> AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
>>
>> Le informazioni contenute in questo messaggio di posta elettronica e/o
>> nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro
>> utilizzo è consentito esclusivamente al destinatario del messaggio, per le
>> finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio
>> senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia
>> via e-mail e di procedere alla distruzione del messaggio stesso,
>> cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo
>> anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per
>> finalità diverse, costituisce comportamento contrario ai principi dettati
>> dal D.Lgs. 196/2003.
>>
>>
>>
>> The information in this message and/or attachments, is intended solely for
>> the attention and use of the named addressee(s) and may be confidential or
>> proprietary in nature or covered by the provisions of privacy act
>> (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
>> Code).Any use not in accord with its purpose, any disclosure, reproduction,
>> copying, distribution, or either dissemination, either whole or partial, is
>> strictly forbidden except previous formal approval of the named
>> addressee(s). If you are not the intended recipient, please contact
>> immediately the sender by telephone, fax or e-mail and delete the
>> information in this message that has been received in error. The sender does
>> not give any warranty or accept liability as the content, accuracy or
>> completeness of sent messages and accepts no responsibility  for changes
>> made after they were sent or for other risks which arise as a result of
>> e-mail transmission, viruses, etc.
>
>
>
> _______________________________________________
> geonode-devel mailing list
> geonode-devel at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/geonode-devel
>



-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the geonode-devel mailing list