Use createSQL to add the view.
The SQL in createSQL will get added to the SQL in createTableSQL.
createSQL takes a list of string SQL statements.
Example:
class MyView(SQLObject):
class sqlmeta:
createSQL = ["CREATE VIEW myview AS SELECT * FROM mytable;",
"...",
]
--
Rick
On Sun, 12 Nov 2006, jt wrote:
> On 11/7/06, Oleg Broytmann <[EMAIL PROTECTED]> wrote:
>> .createTableSQL() returns two SQL queries - to create the table and to
>> apply the constraints - but doesn't run the queries itself. The purpose, if
>> I understand it right, is to collect all SQL queries and run them in any
>> order you want. But one has to run theese queries himself.
>
> OK but wouldn't it be easier if one can simply override
> .createTableSQL(), something like :
>
> class MyView(SQLObject):
> @classmethod
> def createTableSQL(self, createJoinTables=True,
> createIndexes=True,
> connection=None):
> # super call here if needed
> query = "CREATE VIEW myview AS SELECT * FROM mytable;"
> constraints = []
> return (query, constraints)
>
> Then all one has to do is calling
> MyView.createTable(ifNotExists=True). This is not possible for the
> moment.
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> sqlobject-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss