We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Congratulations on a job well done; that is an incredible series.
I recently run into an issue when using the TIMESTAMP with SQLite database.
Here's a brief of what's up.
With this ;
created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=text('now()')
An exception is raised.
def do_execute(self, cursor, statement, parameters, context=None): > cursor.execute(statement, parameters) E sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) near "(": syntax error E [SQL: E CREATE TABLE posts ( E id INTEGER NOT NULL, E title VARCHAR NOT NULL, E content VARCHAR NOT NULL, E published BOOLEAN DEFAULT 'TRUE' NOT NULL, E created_at TIMESTAMP DEFAULT now() NOT NULL, E PRIMARY KEY (id) E ) E E ] E (Background on this error at: https://sqlalche.me/e/14/e3q8)
However, modifying the column to use DateTime works for both;
created_at = Column(DateTime(timezone=True), default=func.now())
Is there any chance that a fix for this will be available?
The text was updated successfully, but these errors were encountered:
Hello! I see a problem. I think you are missing a ) at the end of the line.
It should be like this:
created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=text('now()'))
Sorry, something went wrong.
I had the same issue but found a discussion there
Also I'm using SQLAlchemy==2.0.25 so that's different from the version Sanjeev has in his requirements.
SQLAlchemy==2.0.25
from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, DateTime from sqlalchemy.sql import func created_at = Column(DateTime(timezone=True), server_default=func.now())
No branches or pull requests
Congratulations on a job well done; that is an incredible series.
I recently run into an issue when using the TIMESTAMP with SQLite database.
Here's a brief of what's up.
With this ;
An exception is raised.
However, modifying the column to use DateTime works for both;
Is there any chance that a fix for this will be available?
The text was updated successfully, but these errors were encountered: