DatabaseError in latest master

24 views
Skip to first unread message

Lukas Heiniger

unread,
Oct 16, 2014, 3:26:04 AM10/16/14
to openqua...@googlegroups.com
Hi all

...not sure if this is the right place to post this...

I'm working with the latest master of openquake (all components) since I'm experimenting with some of the new GMPEs. When I run the risk part of the ClassicalPSHA demo with

oq-engine --rr job_risk.ini --hazard-output-id XX --no-distribute

I run into the following error:
 
... 
File "<oq engine path>/calculators/risk/hazard_getters.py", line 326, in __init__
    cursor.execute(self.assoc_query)
  File "/Users/Lukas/.virtualenv/openquake/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute
    return self.cursor.execute(query, args)
DatabaseError: syntax error at or near "INSERT"
LINE 10: INSERT INTO riskr.asset_site (job_id, asset_id, site_id)
         ^

Any idea why this happens / what I can do about it? 

- Lukas

Daniele Viganò

unread,
Oct 16, 2014, 3:29:24 AM10/16/14
to openqua...@googlegroups.com
Hi Lukas,

what's the output from

oq-engine --upgrade-db

?

--
You received this message because you are subscribed to the Google Groups "OpenQuake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openquake-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
DANIELE VIGANÒ | System Administrator | Skype dennyv85 | +39-0382-5169882
GLOBAL EARTHQUAKE MODEL | working together to assess risk
GEM - globalquakemodel.org | T - @GEMwrld | F - GEMwrld

Lukas Heiniger

unread,
Oct 16, 2014, 3:33:53 AM10/16/14
to openqua...@googlegroups.com
I remember running this yesterday after pulling the latest commits. Right now it says

Your database is already updated at version 0008.

Michele Simionato

unread,
Oct 16, 2014, 4:16:11 AM10/16/14
to openqua...@googlegroups.com
The error is really strange. You are running a classical calculation but you are in a part of the code which is relevant only for the event based. Are you sure that you gave the right --hazard-output-id?
I mean it must be an output produced by the previous classical calculation, not another one. I cannot reproduce your problem.
 

Lukas Heiniger

unread,
Oct 16, 2014, 4:53:30 AM10/16/14
to openqua...@googlegroups.com
Pretty sure yes. 

I start with the following from demos/risk/ClassicalPSHA

oq-engine --rh job_hazard.ini --no-distribute

which results in

  id | output_type | name
7133 | Hazard Curve | Hazard Curve rlz-1281-PGA
7132 | Hazard Curve (multiple imts) | hc-multi-imt-rlz-1281

and then use 7133 as the input for risk. 

Thanks for trying to help. I will go back and check if I missed something.

Michele Simionato

unread,
Oct 16, 2014, 5:26:47 AM10/16/14
to openqua...@googlegroups.com
What if you use --hazard-calculation-id instead of --hazard-output-id?

Lukas Heiniger

unread,
Oct 16, 2014, 8:39:27 AM10/16/14
to openqua...@googlegroups.com
Same thing unfortunately.

FWIW, the offending SQL statement looks as follows

WITH assocs AS (
  SELECT 114, exp.id, hsite.id
  FROM riski.exposure_data AS exp
  JOIN hzrdi.hazard_site AS hsite
  ON exp.site::text = hsite.location::text
  WHERE hsite.hazard_calculation_id = 105
  AND exposure_model_id = 5 AND taxonomy=E'RC'
  AND ST_COVERS(ST_GeographyFromText(E'POLYGON ((78.0000000000000000 31.5000000000000000, 89.5000000000000000 31.5000000000000000, 89.5000000000000000 25.5000000000000000, 78.0000000000000000 25.5000000000000000, 78.0000000000000000 31.5000000000000000))'), exp.site)
)
INSERT INTO riskr.asset_site (job_id, asset_id, site_id)
SELECT * FROM assocs

But if you're saying the code shouldn't even go there, then that's probably irrelevant.

Lukas Heiniger

unread,
Oct 16, 2014, 8:56:46 AM10/16/14
to openqua...@googlegroups.com
Actually I think this might be due to the fact that I'm running postgres 9.0. From the documentation it looks like this kind of statement is only supported with 9.1.

Michele Simionato

unread,
Oct 16, 2014, 9:00:47 AM10/16/14
to openqua...@googlegroups.com


On Thursday, October 16, 2014 2:56:46 PM UTC+2, Lukas Heiniger wrote:
Actually I think this might be due to the fact that I'm running postgres 9.0. From the documentation it looks like this kind of statement is only supported with 9.1.


But what platform are you using? Notice that we only support Ubuntu 12.04, on any other platform the installation is at you risk and peril, and I assure you that there is much peril!
My suggestion is to stick to the recommended platform and libraries, in particular you can use the nightly builds.

Lukas Heiniger

unread,
Oct 16, 2014, 10:38:27 AM10/16/14
to openqua...@googlegroups.com
That was it, upgraded to postgresql 9.1 now it seems to work.

I'm on OS X... I'm feeling adventurous :). No, actually I'm developing a software on OS X that might at some point call openquake, that's the main reason why. I'm also the guy who wrote the OS X install instructions a while ago (which I have now updated).

Thanks again and sorry for wasting your time with my unsupported platform.

- Lukas

Daniele Viganò

unread,
Oct 16, 2014, 1:24:52 PM10/16/14
to openqua...@googlegroups.com
Dear Lukas,

thanks for your feedback, is always welcome!

About software versions you can refer to this page: https://github.com/gem/oq-engine/wiki/Technology-Stack it contains almost all the software that requires a specific version and the versions which are known to work with the OQE.

Thanks also for your work with Mac OS X. I was planning to create a binary distribution for Mac OS X 10.9 in a similar way we are supporting CentOS/RHEL (https://github.com/daniviga/openquake-centos); I'll test this approach as soon I'll have some time.

Thanks,
Daniele

--
You received this message because you are subscribed to the Google Groups "OpenQuake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openquake-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages