misc/scripts/pyroforge2datafeed.py
author Julien Cristau <julien.cristau@logilab.fr>
Wed, 14 Oct 2015 16:18:25 +0200
changeset 10805 de4403644b1c
parent 10663 54b8a1f249fb
permissions -rw-r--r--
[server/datafeed] drop URLLibResponseAdapter.info I don't know where it's used
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     1
"""turn a pyro source into a datafeed source
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     2
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     3
Once this script is run, execute c-c db-check to cleanup relation tables.
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     4
"""
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
     5
from __future__ import print_function
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
     6
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     7
import sys
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     8
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     9
try:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    10
    source_name, = __args__
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    11
    source = repo.sources_by_uri[source_name]
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    12
except ValueError:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    13
    print('you should specify the source name as script argument (i.e. after --'
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    14
          ' on the command line)')
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    15
    sys.exit(1)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    16
except KeyError:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    17
    print('%s is not an active source' % source_name)
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    18
    sys.exit(1)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    19
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    20
# check source is reachable before doing anything
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    21
try:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    22
    source.get_connection()._repo
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    23
except AttributeError:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    24
    print('%s is not reachable. Fix this before running this script' % source_name)
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
    sys.exit(1)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    26
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    27
raw_input('Ensure you have shutdown all instances of this application before continuing.'
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    28
          ' Type enter when ready.')
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    29
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
system_source = repo.system_source
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    31
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    32
from base64 import b64encode
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
from cubicweb.server.edition import EditedEntity
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    34
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    35
DONT_GET_BACK_ETYPES = set(( # XXX edit as desired
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    36
        'State',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
        'RecipeStep', 'RecipeStepInput', 'RecipeStepOutput',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
        'RecipeTransition', 'RecipeTransitionCondition',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
        'NarvalConditionExpression', 'Recipe',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
        # XXX TestConfig
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    41
        ))
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    42
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    43
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    44
print('******************** backport entity content ***************************')
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    45
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    46
from cubicweb.server import debugged
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    47
todelete = {}
8008
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    48
host = source.config['base-url'].split('://')[1]
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    49
for entity in rql('Any X WHERE X cw_source S, S eid %(s)s', {'s': source.eid}).entities():
8900
010a59e12d89 use cw_etype instead of __regid__
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8696
diff changeset
    50
        etype = entity.cw_etype
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    51
        if not source.support_entity(etype):
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    52
            print("source doesn't support %s, delete %s" % (etype, entity.eid))
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    53
        elif etype in DONT_GET_BACK_ETYPES:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    54
            print('ignore %s, delete %s' % (etype, entity.eid))
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    55
        else:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    56
            try:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    57
                entity.complete()
8008
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    58
                if not host in entity.cwuri:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    59
                    print('SKIP foreign entity', entity.cwuri, source.config['base-url'])
8008
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    60
                    continue
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    61
            except Exception:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    62
                print('%s %s much probably deleted, delete it (extid %s)' % (
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    63
                    etype, entity.eid, entity.cw_metainformation()['extid']))
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    64
            else:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    65
                print('get back', etype, entity.eid)
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    66
                entity.cw_edited = EditedEntity(entity, **entity.cw_attr_cache)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    67
                system_source.add_entity(session, entity)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    68
                sql("UPDATE entities SET asource=%(asource)s, source='system', extid=%(extid)s "
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    69
                    "WHERE eid=%(eid)s", {'asource': source_name,
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    70
                                          'extid': b64encode(entity.cwuri),
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    71
                                          'eid': entity.eid})
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    72
                continue
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
        todelete.setdefault(etype, []).append(entity)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    74
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    75
# only cleanup entities table, remaining stuff should be cleaned by a c-c
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    76
# db-check to be run after this script
10663
54b8a1f249fb [py3k] dict.itervalues → dict.values
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10589
diff changeset
    77
for entities in todelete.values():
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
    system_source.delete_info_multi(session, entities, source_name)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    79
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    80
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    81
print('******************** backport mapping **********************************')
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
session.disable_hook_categories('cw.sources')
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    83
mapping = []
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    84
for mappart in rql('Any X,SCH WHERE X cw_schema SCH, X cw_for_source S, S eid %(s)s',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    85
                   {'s': source.eid}).entities():
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    86
    schemaent = mappart.cw_schema[0]
8900
010a59e12d89 use cw_etype instead of __regid__
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8696
diff changeset
    87
    if schemaent.cw_etype != 'CWEType':
010a59e12d89 use cw_etype instead of __regid__
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8696
diff changeset
    88
        assert schemaent.cw_etype == 'CWRType'
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
        sch = schema._eid_index[schemaent.eid]
10663
54b8a1f249fb [py3k] dict.itervalues → dict.values
Rémi Cardona <remi.cardona@logilab.fr>
parents: 10589
diff changeset
    90
        for rdef in sch.rdefs.values():
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    91
            if not source.support_entity(rdef.subject) \
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    92
                    or not source.support_entity(rdef.object):
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    93
                continue
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    94
            if rdef.subject in DONT_GET_BACK_ETYPES \
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    95
                    and rdef.object in DONT_GET_BACK_ETYPES:
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
    96
                print('dont map', rdef)
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    97
                continue
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    98
            if rdef.subject in DONT_GET_BACK_ETYPES:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    99
                options = u'action=link\nlinkattr=name'
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   100
                roles = 'object',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   101
            elif rdef.object in DONT_GET_BACK_ETYPES:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   102
                options = u'action=link\nlinkattr=name'
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   103
                roles = 'subject',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   104
            else:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   105
                options = u'action=copy'
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   106
                if rdef.rtype in ('use_environment',):
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   107
                    roles = 'object',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   108
                else:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   109
                    roles = 'subject',
10589
7c23b7de2b8d [py3k] print function
Samuel Trégouët <samuel.tregouet@logilab.fr>
parents: 10366
diff changeset
   110
            print('map', rdef, options, roles)
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   111
            for role in roles:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   112
                mapping.append( (
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   113
                        (str(rdef.subject), str(rdef.rtype), str(rdef.object)),
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   114
                        options + '\nrole=%s' % role) )
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   115
    mappart.cw_delete()
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   116
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   117
source_ent = rql('CWSource S WHERE S eid %(s)s', {'s': source.eid}).get_entity(0, 0)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   118
source_ent.init_mapping(mapping)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   119
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   120
# change source properties
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   121
config = u'''synchronize=yes
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   122
synchronization-interval=10min
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   123
delete-entities=no
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   124
'''
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   125
rql('SET X type "datafeed", X parser "cw.entityxml", X url %(url)s, X config %(config)s '
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   126
    'WHERE X eid %(x)s',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   127
    {'x': source.eid, 'config': config,
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   128
     'url': source.config['base-url']+'/project'})
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   129
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   130
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   131
commit()
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   132
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   133
from cubes.apycot import recipes
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   134
recipes.create_quick_recipe(session)