Thank you Bruno for this beautiful SQLTABLES drop in replacement.
Joined Rows, virtual fields on Rows work! You saved my week.
Looks great and I love client side sorting and searching. On
small(hundreds of rows) its faster than server side.
Is there an SQL query that gives the desired result?
> I saw one previously on this list but can't seem to find it right now.
Was it plugin by Selecta?
http://groups.google.com/group/web2py/browse_thread/thread/52014e4b0adf5888/013d69bb1fe9008c?lnk=gst&q=tools+to+manage+users+%2F+groups+%2F+permissions#013d69bb1fe9008c
Wold love to test it with joins.
> This is my working
> code: http://snipt.net/rochacbruno/virtual-fields-in-sqltabe
> Note the headers=None
> So need to patch the header definition to use the virtualfieldname, or
> better, How to define a label for a virtual field?
I think you can try to add label property to your MyVirtualFiel
Your code works on my 3 weeks old web2py and MySQL.
I can insert/view the table with db admin.
You can put anything in SQLTABLE by modifying Rows object with
rows.setvirtualfields.
See this post
http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689
Example of usage is like this:
{{=plugin_datatable(db(db.shout.id>0).select(),_class='datatable')}}
I think plugin_datatable wants Rows object as a parameter, not a table
created with SQLTABLE
> In the example I provide (entity), specifically for web2py and
> relational databases, does it actually make sense to separate 'entity'
> to its own table and use 1:1 relationships from tables A/B/C, or is it
> recommended to just embed the 'entity' fields into tables A/B/C
> (without any referen
>> I have a 'central' table in my design called 'entity'
>> which contains lots of data (including names, company, emails, phones,
>> address, etc.) and I want many other tables to point to ONE entity
>> instance, i.e. 'entity' as an _extension_ of records in many different
>> tables.
When you sa
Maybe WebGrid(http://web2pyslices.com/main/slices/take_slice/39) can
help you? I didn't use it but it says that it lets you build a table
that supports paging, sorting, editing and totals easily.
Or you can put forms in a SQLTABLE column. How to add columns to
SQLTABLE is being discussed in tread:
Sorry for posting what I'v already posted, but it looks like my post
on the patch to make SQLTABLE work with Rows object with added virtual
fields was lost.
I think the easiest solution to add a column to select result and view
the result in SQLTABLE wold be something like:
class ExtraFields:
Perhaps my statement is wrong.
DAL works fine with keyed tables.
When I started to make web2py interface to a legacy database I tried
keyed tables because many tables in the db have composite primary
keys. I kept bumping in documentation examples that describe how to do
things with normal id tables
The patch is in the text of this message:
patch to make Rows.setvirtualfields work with SQLTABLE
http://groups.google.com/group/web2py/browse_thread/thread/826a37f56c26d689/210036457d278cdc?lnk=gst&q=patch+to+make+Rows.setvirtualfields+work+with+SQLTABLE#210036457d278cdc
or e-mailing patched sql
> Will the patch be included in Web2py? I hope Massimo
> likes it.
So do I. Otherwise I will have to patch after every web2py update.
> I want to customize the result of SQLTABLE so that it can make me a
> nice table without lines and lines of code in my view file. To
> achieve that, I need for example to:
You can add any column to select result. The result can be passed to
SQLTABLE.
See:
http://groups.google.com/group/web2py/b
> I want to customize the result of SQLTABLE so that it can make me a
> nice table without lines and lines of code in my view file. To
> achieve that, I need for example to:
>
> 1) Add columns to hold icons and links and extra stuff.
> 2) Customize the rows, e.g. links which depend on content,
motivation:
It wold by nice to have a tool to add arbitrary columns to
db().select() result
to be able to create multiple views of the same tables(including
joins).
That wold be especially valuable when dealing with legacy databases
when you can't design the database according to the web user
i
2010/11/14 Rishu :
> Hi all,
> I have a project in which I am supposed to use mysql. The database
> already made up. I am facing an issue with the primary key check.
> Whensover i insert a duplicate value for the primary key i end up with
> a ticket rather than a graceful handling.
> Here's the db
You can simply put
DEMO_MODE=False
in your db.py
Thank you Massimo,
with KeyedTable I get the same errors.
BUT if tables defined like this:
db.define_table('cars',
Field('car_id','id'), #note 'id' type
Field('model_id','integer'),
migrate=False
)
#note no primaykey
everything works!
I think it shell be int the docs in BIG le
Hi All!
Dealing with a legacy db.
the model:
db.define_table('cars',
Field('car_id','integer',writable=False),
Field('model_id','integer'),
primarykey=['car_id'],
migrate=False
)
If I go to appadmin and try to update any row in the table i get :
SyntaxError: user is tampering w
>2010/10/7 DJ :
> The legacy database to Web2py conversion would be a great add-on. I
> get the following errors when I tried this script on a database with
> tables having primary key 'id' set to autoincrement.
>
> C:\Program Files (x86)\web2py\scripts>extract_mysql_models.py
> bio:b...@nrcf
> Tra
Massimo, Denes,
thank you for your answers.
Before touching sql.py I have updated web2py to recent version(1.86.1)
and found that now references in KeyedTable do work now if string
notation is used like this:
Field('model_id', 'reference car_models.model_id'),
After this
print( getattr(db.car_
>2010/10/3 mdipierro :
> Since August we had many improvements in sql.py that were not
> reflected into dal.py.
So shell I start hacking DAL or wait for improvements to be put in?
> web2py is still using sql.py and it will be a little while before we
> move to dal.py
If I start hacking how do I
Hi Denes,
>2010/10/3 DenesL :
> Hi Ivan,
>
> mysql is not one of the supported DBs for keyed tables:
> only DB2, MSSQL, Ingres, and Informix have been added as per
I looked at dal.py (web2py 1.83.2 2010-08-15). It has
# list of drivers will be built on the fly
# and lists only what is available
>2010/10/3 mdipierro
>
> ... but SQLFORM and web2py crud will not work with sqlalchemy.
>
> one reasons we cannot do something like SQLAlchemy's reflect in web2py
> is that the database is not aware of how web2py should treat the
> field. For example a 'varchar' field could be a 'string', a
> 'pas
2010/10/2 Mariano Reingart
>
> Did you try string notation for references?
>
> db.define_table('cars',
> Field('car_id','integer'),
>Field('model_id', "reference car_models.model_id"),
>Field('note','text'),
> primarykey=['car_id'],
> migrate=False
> )
>
> Anyway, if you are using s
2010/10/1 mdipierro
> keyed tables are only partially supported. Perhaps user Denes can say
> more about that. For now here is a quick hack that should work:
>
>
Thank you for fast reply.
> db.define_table('cars',
>Field('car_id','integer'),
>Field('model_id',
> 'integer',requires=IS_IN
Hello All,
I'm trying to make a web2py interface to a legacy db(mysql).
The db is defined like this:
CREATE TABLE `car_models` (
`model_id` int(10) unsigned NOT NULL auto_increment,
`model_name` text NOT NULL,
PRIMARY KEY (`model_id`)
)
CREATE TABLE `cars` (
`car_id` int(10) unsigned NOT
30 matches
Mail list logo