declare geolocation fields in schema files (fixes #14572)
It's declared as a measure whose value is the array aggregate of the points.
This commit is contained in:
parent
c51d61e5ac
commit
437f4924d2
|
@ -24,3 +24,8 @@ cube.
|
|||
--key KEY HMAC key for signatures
|
||||
--pg-dsn PG_DSN Psycopg2 DB DSN
|
||||
--schema SCHEMA schema name
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
PostgreSQL > 9.4 is required.
|
||||
|
|
|
@ -227,6 +227,12 @@ class WcsOlapFeeder(object):
|
|||
'count({fact_table}.id) * 100. / (select '
|
||||
'count({fact_table}.id) from {table_expression} where '
|
||||
'{where_conditions}) end',
|
||||
},
|
||||
{
|
||||
'name': 'geolocation',
|
||||
'label': 'localisation géographique',
|
||||
'type': 'point',
|
||||
'expression': 'array_agg("{fact_table}".geolocation_base) FILTER (WHERE "{fact_table}".geolocation_base IS NOT NULL)',
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -383,6 +389,7 @@ CREATE TABLE public.dates AS (SELECT
|
|||
['generic_status_id', 'smallint REFERENCES {generic_status_table} (id)'],
|
||||
['endpoint_delay', 'interval'],
|
||||
['first_agent_id', 'smallint REFERENCES {agent_table} (id)'],
|
||||
['geolocation_base', 'POINT NULL'],
|
||||
['json_data', 'JSONB NULL'],
|
||||
]
|
||||
self.comments = {
|
||||
|
@ -393,6 +400,7 @@ CREATE TABLE public.dates AS (SELECT
|
|||
'backoffice': u'soumission backoffce',
|
||||
'generic_status_id': u'statut simplifié',
|
||||
'endpoint_delay': u'délai de traitement',
|
||||
'geolocation_base': u'position géographique',
|
||||
}
|
||||
self.create_table('{generic_formdata_table}', self.columns)
|
||||
for at, comment in self.comments.iteritems():
|
||||
|
@ -561,6 +569,8 @@ class WcsFormdefFeeder(object):
|
|||
|
||||
self.columns = ([name for name, _type in self.olap_feeder.columns]
|
||||
+ [name for name, _type in columns])
|
||||
self.columns.remove('geolocation_base')
|
||||
|
||||
self.create_table('{formdata_table}', columns, inherits='{generic_formdata_table}',
|
||||
comment=u'formulaire %s' % self.formdef.schema.name)
|
||||
for at, comment in comments.iteritems():
|
||||
|
@ -589,7 +599,8 @@ class WcsFormdefFeeder(object):
|
|||
['date', 'date'],
|
||||
['hour_id', 'smallint REFERENCES {hour_table} (id)'],
|
||||
])
|
||||
self.ex('COMMENT ON TABLE {evolution_table} IS %s', vars=(u'evolution des demandes %s' % self.formdef.schema.name,))
|
||||
self.ex('COMMENT ON TABLE {evolution_table} IS %s',
|
||||
vars=(u'evolution des demandes %s' % self.formdef.schema.name,))
|
||||
|
||||
def insert_item_value(self, field, value):
|
||||
table_name = self.hash_table_name('{formdata_table}_field_%s' % field.varname)
|
||||
|
|
Loading…
Reference in New Issue