Skip to Content

Error while calling procedure from python sqlalchemy


I am getting an error when i call a stored procedure with table type input and a varchar out param from python using the sqlalchemy lib.Below mentioned is the error

Error while calling procedure from python sqlalchemy.exc.DatabaseError: (pyhdb.exceptions.DatabaseError) invalid argument: Input parameter is inadequate as table parameter:

parameter one is table type in and second is a varchar out

I am adding the code snippet which i am trying with

engine = create_engine("hana+pyhdb://{username}:{password}@{host}:{port}".format(username='username', password='password', host='hostname', port='30015'))

test=engine.execute('call SCHEMA.PROC(?,?)',(data,output))
Add a comment
10|10000 characters needed characters exceeded

  • Thank you for visiting SAP Community to get answers to your questions. Since you're asking a question here for the first time, I recommend that you familiarize yourself with (if you haven't already), as it provides tips for preparing questions that draw responses from our members.

    Should you wish, you can revise your question by selecting Actions, then Edit (although once someone answers your question, you'll lose the ability to edit the question -- but if that happens, you can leave more details in a comment).


Related questions

2 Answers

  • Posted on Mar 16 at 09:45 AM

    Hi Arunkumar KP, The hana_ml library can upload a Pandas dataframe into HANA. It creates the table in the necessary format and persists the data. Witalij Rudnicki shows an example in his blog

    The create_dataframe_from_pandas function is explained here

    More information on the hana_ml wrapper in the blog by Christoph Morgen

    Please just verify with your Account Executive, that your HANA license allows this usage.
    Many Greetings Andreas

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 12 at 05:42 AM

    Dear Arunkumar

    Actually the DB procedure a table[] is expected... not the string of data.

    So you may have to write something like this

    DO BEGIN    
    -- select values from table to fill the table
       tabledata = SELECT * from xyz;            
     test=engine.execute('call SCHEMA.PROC(?,?)',(tabledata,output))
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.