That almost works. It appears I can pass the variable by executing the 'set bindings' command ahead of the query. But if I use the variable in a test like this: declare variable $ext_variable as xs:string external; for $div in collection('waldo')//div[@xml:id=$ext_variable] I get nothing. And yet I've been able to return the variable itself from the module and check its type, and use it in a let assignment. So I can see that the module is receiving the value I send, it just isn't matching for some reason. Bryan Cholfin Associate Editor for Digital Projects and Metadata Harvard University Press 617.496.9116 79 Garden Street | Cambridge, MA 02138-1400 www.hup.harvard.edu<http://www.hup.harvard.edu/> From: Etanchaud Fabrice <Fabrice.Etanchaud@horanet.com<mailto:Fabrice.Etanchaud@horanet.com>> Date: Tuesday, November 17, 2015 at 4:08 AM To: "Cholfin, Bryan" <bryan_cholfin@harvard.edu<mailto:bryan_cholfin@harvard.edu>>, "basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>" <basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de>> Subject: RE: [basex-talk] sending variables to xquery module via client api (python) Hi Bryan, Could http://docs.basex.org/wiki/Options#BINDINGS<https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Options-23BINDINGS&d=CwMFAw&c=WO-RGvefibhHBZq3fL85hQ&r=C4uQXgUAXNtbbQkRcZb0vaWguMqZEgRZCutfoNwnQQw&m=-AZnTfqEvRN4z1HbMindlhvsaxlJlHG659XcUZIt8gs&s=SpD3uzuuWn2uibxXkTFXu4Wm7x01rF-GiozkwuutTeA&e=>give you a solution ? Best regards, Fabrice De : basex-talk-bounces@mailman.uni-konstanz.de<mailto:basex-talk-bounces@mailman.uni-konstanz.de> [mailto:basex-talk-bounces@mailman.uni-konstanz.de] De la part de Cholfin, Bryan Envoyé : lundi 16 novembre 2015 23:08 À : basex-talk@mailman.uni-konstanz.de<mailto:basex-talk@mailman.uni-konstanz.de> Objet : [basex-talk] sending variables to xquery module via client api (python) Hi- Hoping someone can help me with this. I'm trying to write a python script that calls an xquery module in the database. It seems to be pretty easy to use a line such as: session.execute("run gettext.xqm") and get back the response I want. What I want to do is pass a bound variable to the module. The client api has a provision to bind a variable to a query object, but I'm not making a query object. I'm simply executing the stored query. I don't find anything in the documentation to suggest that a variable can be added to the run command this way. Bryan Cholfin Associate Editor for Digital Projects and Metadata Harvard University Press 617.496.9116 79 Garden Street | Cambridge, MA 02138-1400 www.hup.harvard.edu<http://www.hup.harvard.edu/>