4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SQLAlchemyでTime型を保存する

Last updated at Posted at 2015-11-20

Time型を使って今の時間を保存するのは以下のコード

import datetime
from sqlalchemy import (Text, Time)
class Tel(Base):
    __tablename__ = 'tel'
    no = Column(Text)
    updated_at = Column(Time, default=datetime.datetime.now().time())

時間の扱い方が、こなれてない気がしてならない・・・

ここのページの「A type for 〜」見ると、SQLAlchemyの型とPythonの型のマッピングがわかる。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?