[Zope] ZSQL Create Table

rgines@purina.com rgines@purina.com
Fri, 19 Nov 1999 19:28:28 -0600


I've been trying to create tables through ZSQL Methods and have been
getting some strange results.   From the few posts that I have seen in the
archives it looks like there have been some behavioral changes from Zope
1.x to 2.x that effect the ZSQ addMethod.

For example, from the ZSQL add form method if you use

     Create table testtwo (col_c varchar, col_d varchar)

as the 'Query' you get a responce to the effect that
this is not a query ...  which I would agree with, but I'm not
in the habit of arguing with my computers.

If you try to run the Method a second time you get the error

     Error, exceptions.NameError: cannot create TESTTWO,
                                                exists

Using the template from 'Sample of DTML Scripting and Gadfly' at
classic.zope.org:8080/Documentation/HowTo/SampleGadfly/index_html

I try to execute

     ...
     <!--#call "Sample.manage_addZSQLMethod('create_table','',
     'zopadelic','','create table zopista (col_a integer, col_b
integer)')"-->
     ...

The error I get is

     Error Type: AttributeError
                Error Value: manage_addZSQLMethod

With a traceback of

Traceback (innermost last):
  File D:\PROGRA~1\GYNZER~1\lib\python\ZPublisher\Publish.py, line 214, in
publish_module
  File D:\PROGRA~1\GYNZER~1\lib\python\ZPublisher\Publish.py, line 179, in
publish
  File D:\PROGRA~1\GYNZER~1\lib\python\Zope\__init__.py, line 201, in
zpublisher_exception_hook
    (Object: ApplicationDefaultPermissions)
  File D:\PROGRA~1\GYNZER~1\lib\python\ZPublisher\Publish.py, line 165, in
publish
  File D:\PROGRA~1\GYNZER~1\lib\python\ZPublisher\mapply.py, line 160, in
mapply
    (Object: GadflyTestCreate)
  File D:\PROGRA~1\GYNZER~1\lib\python\ZPublisher\Publish.py, line 102, in
call_object
    (Object: GadflyTestCreate)
  File D:\PROGRA~1\GYNZER~1\lib\python\OFS\DTMLMethod.py, line 145, in
__call__
    (Object: GadflyTestCreate)
  File D:\PROGRA~1\GYNZER~1\lib\python\DocumentTemplate\DT_String.py, line
502, in __call__
    (Object: GadflyTestCreate)
  File D:\PROGRA~1\GYNZER~1\lib\python\DocumentTemplate\DT_Util.py, line
321, in eval
    (Object:
Sample.manage_addZSQLMethod('create_table','','zopadelic','','create table
zopista (col_a integer, col_b integer)'))
  File <string>, line 0, in ?
  File D:\PROGRA~1\GYNZER~1\lib\python\DocumentTemplate\DT_Util.py, line
125, in careful_getattr
AttributeError: (see above)

I looked at the SQL.py file and the attributes seem to be passing
correctly, but I'm still a python
newbie ... although ramping up quickly.


Any assistance would be apprecited.  Thanks.