From: Bud P. B. <bu...@si...> - 2003-04-09 07:53:04
|
Hi Ian, I'll probably try to clean up the example and send it (looking at the tests and the code...). Also, I was looking through the doc of automatic schema generation and have some questions (that I hope are productive): * createTable(ifNotExists=True): I understand that the default (False) means that tables are created in any case, even if they exist already. Wouldn't it be a better default to create them only if they don't exist already? (Does it raise an exception if already existing tables are re-created or does it simply drop the old ones? -- maybe you could add that to the doc). My rational for asking for this default is that it seems safer and the option could possibly be called "force" instead of ifNotExists--that seems closer to what I would expect (at least in a Unix environment). * dropTable(ifExists=..): is this really necessary? What happens if it does not exist (nothing or exception)? Maybe there is something I don't understand, but I would be happy that after calling dropTable, the table is gone (or else, an exception is raised) no matter what the state was before. (I try to avoid methods with pre-conditions as much as ever possible) * dropTable(dropJoinTables=...): I am wondering whether it makes sense to keep joinTables around since really they make reference to rows in the table and leaving them around leads to dangling references. I noted that the SQL you create for relations does not seem to define foreign keys (at least in an example given in the documentation of an earlier version). But if you had the DBMS take care of these, it would probably even complain to leave the joinTable while removing the other table... hope this is helpful --b On 08 Apr 2003 12:30:30 -0500 Ian Bicking <ia...@co...> wrote: > Damn... I forgot to update the example, it's all broken now. > tests/test.py might be a better example for now (even if not as > compelling) > > On Tue, 2003-04-08 at 12:24, Bud P.Bruegger wrote: > > Ian, > > > > I was excited to see the new release. I just encountered a problem > > when running the people.py example. Gotta run to get my daughter--so > > I thought I'll write this message anyways before I can look into it in > > detail. > > > > I'm running the example with PostgreSQL. I attach the diff that makes > > this somewhat easier (a configuration variable controls which dbms is > > used). > > > > I'm using Python 2.2.1 on Linux. > > > > This is the output to calling > > > > ./people.py create > > > > > > Accessing with user bud and password > > Traceback (most recent call last): > > File "./people.py", line 99, in ? > > table.createTable(ifExists=True) > > TypeError: createTable() got an unexpected keyword argument 'ifExists' > > > > > > Will look at it in more detail tomorrow unless you already solved the > > problem. > > > > cheers > > --bud > > > > > > > > > > On 07 Apr 2003 23:28:52 -0500 > > Ian Bicking <ia...@co...> wrote: > > > > > SQLObject 0.3 has been release: > > > http://sqlobject.org > > /----------------------------------------------------------------- | Bud P. Bruegger, Ph.D. | Sistema (www.sistema.it) | Via U. Bassi, 54 | 58100 Grosseto, Italy | +39-0564-411682 (voice and fax) \----------------------------------------------------------------- |