Re: [web2py] Powertable remarks

2010-12-20 Thread Ivan Matveev
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.

Re: [web2py] SQLTABLE with joined data, but without repeats?

2010-12-11 Thread Ivan Matveev
Is there an SQL query that gives the desired result?

Re: [web2py] administrator controller

2010-12-11 Thread Ivan Matveev
> 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

Re: [web2py] grid

2010-12-11 Thread Ivan Matveev
Wold love to test it with joins.

Re: [web2py] Re: patch to make Rows.setvirtualfields work with SQLTABLE

2010-12-09 Thread Ivan Matveev
> 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

Re: [web2py] Errors when a table references itself (was Re: What does this mean?)

2010-12-09 Thread Ivan Matveev
Your code works on my 3 weeks old web2py and MySQL. I can insert/view the table with db admin.

Re: [web2py] Re: Changing links on SQLTABLE

2010-12-09 Thread Ivan Matveev
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

Re: [web2py] problem with web2py and plugin_datatables

2010-12-03 Thread Ivan Matveev
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

Re: [web2py] Re: crud operations for joins?

2010-11-17 Thread Ivan Matveev
> 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

Re: [web2py] Re: crud operations for joins?

2010-11-17 Thread Ivan Matveev
>> 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

[web2py] Re: Create TRs dinamically in a FORM

2010-11-15 Thread Ivan Matveev
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:

Re: [web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-15 Thread Ivan Matveev
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:

Re: [web2py] Re: The primary key constraint on legacy tables

2010-11-15 Thread Ivan Matveev
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

Re: [web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-15 Thread Ivan Matveev
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

Re: [web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-14 Thread Ivan Matveev
>  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.

[web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-14 Thread Ivan Matveev
> 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

[web2py] Re: Manipulate Rows Object and/or SQLTABLE

2010-11-14 Thread Ivan Matveev
> 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,  

[web2py] patch to make Rows.setvirtualfields work with SQLTABLE

2010-11-13 Thread Ivan Matveev
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

Re: [web2py] The primary key constraint on legacy tables

2010-11-13 Thread Ivan Matveev
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

Re: [web2py] Re: 'DEMO_MODE' is not defined

2010-10-14 Thread Ivan Matveev
You can simply put DEMO_MODE=False in your db.py

Re: [web2py] Re: A strange syntax error on updating a table row in a legacy db.

2010-10-14 Thread Ivan Matveev
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

[web2py] A strange syntax error on updating a table row in a legacy db.

2010-10-11 Thread Ivan Matveev
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

Re: [web2py] Re: plugin legacy mysql: generates web2py code to access your mysql legacy db

2010-10-07 Thread Ivan Matveev
>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

Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-06 Thread Ivan Matveev
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_

Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-03 Thread Ivan Matveev
>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

Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-03 Thread Ivan Matveev
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

Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-02 Thread Ivan Matveev
>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

Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-02 Thread Ivan Matveev
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

Re: [web2py] Re: DAL, legacy keyed table, field references

2010-10-01 Thread Ivan Matveev
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

[web2py] DAL, legacy keyed table, field references

2010-10-01 Thread Ivan Matveev
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