Exemplo n.º 1
0
def introspect_view(entity):
    global connection
    global views
    global refresh_data
    global calc_perf_data
    view = entity.table

    if view in views:
        return
    
    view.entity = entity
    if not view.is_materialized:
        if calc_perf_data:
            Argentum.soil_all_pseudo_materialized()
            (florp, refresh_time) = measure_time(lambda: view.refresh(connection))
            view.soil()
            (florp, refresh_time_single) = measure_time(lambda: view.refresh(connection))
            refresh_data[entity.__name__] = (refresh_time, refresh_time_single)
        else:
            view.refresh(connection)
    views.append(view)
Exemplo n.º 2
0
 def reread(self):
     Argentum.soil_all_pseudo_materialized()
     self.ww_filter.reread()
     self.old_db_where = self.db_where
     self.old_DBModel = self.DBModel
Exemplo n.º 3
0
 def prefetch(cls, session):
     if hasattr(cls,'table'):
         table = cls.table
         for view in Argentum.find_views(table):
             view.refresh(session.connection())
Exemplo n.º 4
0
        def handle_request(self, transaction):
            Argentum.soil_all_pseudo_materialized()

            Webwidgets.Program.Session.handle_request(self, transaction)
Exemplo n.º 5
0
def create_engine(url):
    return Argentum.create_engine(url)
Exemplo n.º 6
0
Arquivo: Model.py Projeto: Frihet/worm
import elixir, itertools
import Worm, Argentum, Worm.Demo.Table.Config

__session__ = None
elixir.options_defaults['inheritance'] = 'single'

engine = Argentum.create_engine(Worm.Demo.Table.Config.database_url)

class Service(Worm.Table.WwModel.DBModel, elixir.entity.Entity):
    country = elixir.Field(elixir.Unicode)
    provider = elixir.Field(elixir.Unicode)
    technology = elixir.Field(elixir.Unicode)

class SpecialService(Service):
    price = elixir.Field(elixir.Unicode)

elixir.setup_all(bind=None)

def createInitialData(session, *arg, **kwarg):
    for country in (u'SE', u'NO', u'FI', u'DK'):
        for provider  in (u'Comm2', u'BandCorp', u'Fieacomm', u'OFelia'):
            for technology in (u'modem', u'DSL1', u'DSL2', u'cable'):
                for price in (u'100-200', u'200-300', u'300-400', u'400-'):
                    session.save(SpecialService(country = country, provider = provider, technology = technology, price = price))