Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create stored procedure failed on Teradata #245

Open
anfrolov opened this issue Mar 6, 2020 · 1 comment
Open

Create stored procedure failed on Teradata #245

anfrolov opened this issue Mar 6, 2020 · 1 comment

Comments

@anfrolov
Copy link

anfrolov commented Mar 6, 2020

I'm trying to create procedure on Teradata using turbodbc. There is my sample code:

import turbodbc
with turbodbc.connect(dsn="my_dsn") as con:
    with con.cursor() as cur:
        cur.execute("""create procedure dev.test_procedure () 
        sql security invoker 
        begin 
            delete dev.test_table ; 
        end ; 
        """)

I have got this error:

DatabaseError: ODBC error
state: 42000
native error code: -3706
message: [Teradata][ODBC Teradata Driver][Teradata Database] Syntax error:
Invalid  SQL Statement.

But, the same code works with no errors in Teradata SQL Assistant.
Also, this code works fine if I use teradatasql:

import teradatasql
with teradatasql.connect(
    '{"host":"my_host","user":"my_user","password":"my_password"}'
) as con:
    with con.cursor() as cur:
        cur.execute("""create procedure dev.test_procedure () 
        sql security invoker 
        begin 
            delete dev.test_table ; 
        end ; 
        """)
@fjetter
Copy link
Collaborator

fjetter commented Mar 11, 2020

I'm not too familiar with Teradata (or teradatasql for that matter). My first gut feeling is that the teradatasql package maybe performs some tokenization / sql parsing or some kind of preprocessing (e.g. stripping whitespaces, etc.) which we do not do. Can you try it with an even simpler statement?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants