is it possible to bypass ZSQL methods and call stored procedures in sqlserver straight from ZPT?
Hi We have some dynamic ZSQL methods all working but are looking to optimise our code and also access some stored procedures which are already written in SQL Server. The question is, can you go straight through to a relational database using the connector object and call a stored procedure straight from a ZPT? Or must you use a ZSQL method to access the procedure? Thanks -- michael
Yes ----- Original Message ----- From: michael nt milne We have some dynamic ZSQL methods all working but are looking to optimise our code and also access some stored procedures which are already written in SQL Server. The question is, can you go straight through to a relational database using the connector object and call a stored procedure straight from a ZPT? Or must you use a ZSQL method to access the procedure?
thanks. Is there an example or a tutorial at all on this anywhere? On 11/6/07, Jaroslav Lukesh <lukesh@seznam.cz> wrote:
Yes
----- Original Message ----- From: michael nt milne We have some dynamic ZSQL methods all working but are looking to optimise our code and also access some stored procedures which are already written in SQL Server.
The question is, can you go straight through to a relational database using the connector object and call a stored procedure straight from a ZPT? Or must you use a ZSQL method to access the procedure?
-- michael
----- Original Message ----- From: "michael nt milne" <michael.milne@gmail.com> To: "zope list user" <zope@zope.org> Sent: Tuesday, November 06, 2007 9:30 AM Subject: Re: [Zope] is it possible to bypass ZSQL methods and callstoredprocedures in sqlserver straight from ZPT?
thanks. Is there an example or a tutorial at all on this anywhere?
On 11/6/07, Jaroslav Lukesh <lukesh@seznam.cz> wrote:
Yes
----- Original Message ----- From: michael nt milne We have some dynamic ZSQL methods all working but are looking to optimise our code and also access some stored procedures which are already written in SQL Server.
The question is, can you go straight through to a relational database using the connector object and call a stored procedure straight from a ZPT? Or must you use a ZSQL method to access the procedure?
You could also write a Product or External Method to access your databases directly, using something like: http://pymssql.sourceforge.net/ Jonathan
You could also write a Product or External Method to access your databases directly, using something like: http://pymssql.sourceforge.net/
you should not do that, you would get into lots of problems with zope's transaction machinery. always go trough a zope connection. robert
+-------[ michael nt milne ]---------------------- | thanks. Is there an example or a tutorial at all on this anywhere? # queryConnection holds the id of a DA connectionObject=getattr(self, queryConnection) connection = connectionObject() results = connection.query(SQL_GOES_HERE) This is from Product code, it should be usable (s/self/context/) in a PythonScript, but, I haven't tested it. -- Andrew Milton akm@theinternet.com.au
ok thanks. I guess then if you're using the ZMI could you embed this in your ZPT? But I guess that is not best practice. On 11/6/07, Andrew Milton <akm@theinternet.com.au> wrote:
+-------[ michael nt milne ]---------------------- | thanks. Is there an example or a tutorial at all on this anywhere?
# queryConnection holds the id of a DA
connectionObject=getattr(self, queryConnection) connection = connectionObject() results = connection.query(SQL_GOES_HERE)
This is from Product code, it should be usable (s/self/context/) in a PythonScript, but, I haven't tested it.
-- Andrew Milton akm@theinternet.com.au
-- michael
+-------[ michael nt milne ]---------------------- | ok thanks. I guess then if you're using the ZMI could you embed this in your | ZPT? But I guess that is not best practice. Using the ZMI you'd make a Python Script to call from your ZPT instead. -- Andrew Milton akm@theinternet.com.au
IIRC, DB connections have a 'manage_test' method that could be (ab) used for things like that. On 6. Nov 2007, at 15:23, Jaroslav Lukesh wrote:
The question is, can you go straight through to a relational database using the connector object and call a stored procedure straight from a ZPT? Or must you use a ZSQL method to access the procedure?
-- Anything that, in happening, causes something else to happen, causes something else to happen. --Douglas Adams
participants (6)
-
Andrew Milton -
Jaroslav Lukesh -
Jonathan -
michael nt milne -
robert rottermann -
Stefan H. Holek