The fact we can store a database in memory does not mean this is the
right solution to your problem.

I would just take the code out of t2 itemize and adapt to your
purposes. It is relatively small.

itemize does very very little for you so I doubt you need it.

Massimo

On Nov 21, 4:07 pm, Baron <[EMAIL PROTECTED]> wrote:
> sorry, I may have my object types wrong.
>
> To summarize:
> I'm trying to pass data directly to t2.itemize() without having to
> write to a database.
>
> If I understood right, Bill was hinting that writing to an in-memory
> database was the easiest way, so I was wondering what was the harder
> alternative way.
> I was hoping there was a way to directly instantiate the required
> input for t2.itemize() directly without going through a database.
> Writing to a temporary in-memory database 'smells' bad for me.
>
> For now I've created my own itemize.
>
> Baron
>
> On Nov 21, 8:11 am, mdipierro <[EMAIL PROTECTED]> wrote:
>
> > What for? SQLTable or SQLTABLE? I am confused.
>
> > Massimo
>
> > On Nov 20, 3:06 pm, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > The easiest way to construct an SQLTable is to use define_table (as in 
> > > > a model like db.py).
>
> > > You say 'easiest' - is there an alternative way to instantiate an
> > > SQLTable object?
>
> > > On Nov 19, 9:20 pm, billf <[EMAIL PROTECTED]> wrote:
>
> > > > OK, I see.  The objects passed to itemize are an SQLTable and,
> > > > optionally, an SQLQuery, that basically filters the rows returned.
> > > > The easiest way to construct an SQLTable is to use define_table (as in
> > > > a model like db.py).  That's why I was suggesting an in-memory
> > > > database which Massimo has now implemented in trunk.
>
> > > > So you should be able to say (I haven't tested this and the while is
> > > > pseudo-code):
>
> > > > dbm=SQLDB('sqlite:memory:')
>
> > > > dbm.define_table('temp_data',SQLField('temp_field1),SQLField
> > > > ('temp_field2'), etc)
>
> > > > while creating_temp_data:
> > > >   dbm.temp_data.insert(temp_field1='X',temp_field2='Y')
>
> > > > t2.itemize(dbm.temp_data)
>
> > > > And all the temp data is just held in memory.  Does that help?
>
> > > > On Nov 19, 8:49 am, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > > > When you say "these tables are Python objects", I assume you are
>
> > > > > refererring to your temporary data(?)
>
> > > > > No, to the table input to itemize. This input is a python object. So
> > > > > can this object be instantiated directly without going through a
> > > > > database?
>
> > > > > On Nov 19, 5:36 pm, billf <[EMAIL PROTECTED]> wrote:
>
> > > > > > When you say "these tables are Python objects", I assume you are
> > > > > > refererring to your temporary data(?)
>
> > > > > > The "detour" above about in-memory tables was just to provide an
> > > > > > alternative to making your own itemize, i.e.:
> > > > > > - define your temp tables as in-memory tables
> > > > > > - insert your "rows" instead of appending to your Python objects
> > > > > > - pass the in-memory tables to the existing itemize
>
> > > > > > (Apologies if that was stating the obvious)
>
> > > > > > On Nov 18, 10:48 pm, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > > > > These tables are Python objects, so is there a way to instantiate 
> > > > > > > them
> > > > > > > without a database?
>
> > > > > > > Otherwise I'll do as you suggest, Bill, and make my own itemize.
> > > > > > > Baron
>
> > > > > > > On Nov 19, 12:33 am, billf <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > I don't think you can - as you say itemize takes tables and an
> > > > > > > > optional query.  I think you will have to create your own 
> > > > > > > > "itemize"
> > > > > > > > that works off your results. Looking at T2.itemize, it should 
> > > > > > > > not be
> > > > > > > > difficult.
>
> > > > > > > > Would it be nice if one could create a database and table in 
> > > > > > > > ram cache
> > > > > > > > (disk cache wouldn't be much better than a conventional temp 
> > > > > > > > table?)
> > > > > > > > and access it like a normal database.  Maybe that is possible 
> > > > > > > > already
> > > > > > > > but I don't think so.
>
> > > > > > > > On Nov 18, 11:47 am, Baron <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > hello,
>
> > > > > > > > > My app calculates temporary data that I want to display to 
> > > > > > > > > the user.
> > > > > > > > > There is a lot of it so paginating it with t2.itemize sounds 
> > > > > > > > > like a
> > > > > > > > > good idea. But itemize takes a database table as input.
>
> > > > > > > > > So, I could write the data to a table and then query it to 
> > > > > > > > > get the
> > > > > > > > > right form, but that would be wasteful. How can I instead 
> > > > > > > > > wrap the
> > > > > > > > > data directly for itemize?
>
> > > > > > > > > thanks,
> > > > > > > > > Baron- Hide quoted text -
>
> > > > > > > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to