1

I'm getting an error with this SQL code when I execute it in my Flask app. I swear I've done this exact thing before and it worked, so I'm not sure what's happening.

Here is the SQL:

DROP TABLE IF EXISTS user;

CREATE TABLE order (
    id TEXT PRIMARY KEY,
    plan_id INTEGER NOT NULL,
    placed TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    ssh_key TEXT NOT NULL,
    region INTEGER NOT NULL,
    operating_system INTEGER NOT NULL,
    enable_ipv6 INTEGER NOT NULL
    expires INTEGER NOT NULL
);

Here is the relevant part of my python error:

sqlite3.OperationalError: near "order": syntax error

Thank you for the help

1 Answer 1

1

Order is a reserved keyword for sqlite. If you want to use a keyword as a name, you need to quote it. https://www.sqlite.org/lang_keywords.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.