misc/scripts/pyroforge2datafeed.py
author David Douard <david.douard@logilab.fr>
Thu, 02 Jul 2015 19:54:25 +0200
changeset 10496 e95b559a06a2
parent 10366 38c7598b5c61
child 10589 7c23b7de2b8d
permissions -rw-r--r--
[doc] more fixes of warnings/errors in doc build - move 3.21.rst changelog description at it's proper place - include changelogs in the main index - few typos - add :noindex: for autoxxx directives not in api/ Related to #4832808
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
"""
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     5
import sys
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     6
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     7
try:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     8
    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
     9
    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
    10
except ValueError:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    11
    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
    12
          ' 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
    13
    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
    14
except KeyError:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    15
    print '%s is not an active source' % source_name
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    16
    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
    17
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    18
# 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
    19
try:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    20
    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
    21
except AttributeError:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    22
    print '%s is not reachable. Fix this before running this script' % source_name
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    23
    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
    24
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    25
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
    26
          ' 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
    27
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    28
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
    29
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    30
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
    31
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
    32
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    33
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
    34
        'State',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    35
        '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
    36
        'RecipeTransition', 'RecipeTransitionCondition',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    37
        'NarvalConditionExpression', 'Recipe',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    38
        # XXX TestConfig
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    39
        ))
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    40
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
print '******************** backport entity content ***************************'
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    43
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    44
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
    45
todelete = {}
8008
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    46
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
    47
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
    48
        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
    49
        if not source.support_entity(etype):
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    50
            print "source doesn't support %s, delete %s" % (etype, entity.eid)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    51
        elif etype 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
    52
            print 'ignore %s, delete %s' % (etype, entity.eid)
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    53
        else:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    54
            try:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    55
                entity.complete()
8008
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    56
                if not host in entity.cwuri:
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    57
                    print 'SKIP foreign entity', entity.cwuri, source.config['base-url']
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    58
                    continue
9489dc9bc114 check entity's cwuri and remove debug
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7917
diff changeset
    59
            except Exception:
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    60
                print '%s %s much probably deleted, delete it (extid %s)' % (
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    61
                    etype, entity.eid, entity.cw_metainformation()['extid'])
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    62
            else:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    63
                print 'get back', etype, entity.eid
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    64
                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
    65
                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
    66
                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
    67
                    "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
    68
                                          '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
    69
                                          '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
    70
                continue
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    71
        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
    72
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    73
# 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
    74
# db-check to be run after this script
8696
0bb18407c053 [toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 8008
diff changeset
    75
for entities in todelete.itervalues():
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    76
    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
    77
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    78
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    79
print '******************** backport mapping **********************************'
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    80
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
    81
mapping = []
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    82
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
    83
                   {'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
    84
    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
    85
    if schemaent.cw_etype != 'CWEType':
010a59e12d89 use cw_etype instead of __regid__
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents: 8696
diff changeset
    86
        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
    87
        sch = schema._eid_index[schemaent.eid]
8696
0bb18407c053 [toward py3k] rewrite dict.keys() and dict.values() (part of #2711624)
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 8008
diff changeset
    88
        for rdef in sch.rdefs.itervalues():
7917
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    89
            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
    90
                    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
    91
                continue
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    92
            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
    93
                    and 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
    94
                print 'dont map', rdef
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    95
                continue
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    96
            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
    97
                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
    98
                roles = 'object',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
    99
            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
   100
                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
   101
                roles = 'subject',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   102
            else:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   103
                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
   104
                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
   105
                    roles = 'object',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   106
                else:
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   107
                    roles = 'subject',
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   108
            print 'map', rdef, options, roles
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   109
            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
   110
                mapping.append( (
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   111
                        (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
   112
                        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
   113
    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
   114
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   115
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
   116
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
   117
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   118
# 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
   119
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
   120
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
   121
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
   122
'''
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   123
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
   124
    '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
   125
    {'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
   126
     '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
   127
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   128
436400e7f807 sample script to turn a pyro source into a datafeed source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
   129
commit()
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
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
   132
recipes.create_quick_recipe(session)