Last active
May 6, 2020 16:09
-
-
Save chespinoza/dd90ddeac9cafb3c35795bf529d42d1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sqlalchemy import Column, Index, Text | |
from sqlalchemy.dialects.postgresql import TIMESTAMP | |
from sqlalchemy.dialects.postgresql.json import JSONB | |
from sqlalchemy.ext.declarative import declarative_base | |
Base = declarative_base() | |
class Products(Base): | |
__tablename__ = "products" | |
asin = Column(Text, primary_key=True) | |
title = Column(Text) | |
parent_asin = Column(Text) | |
marketplace = Column(Text) | |
images = Column(ARRAY(Text)) | |
is_complete = Column(Boolean) | |
inserted_at = Column(TIMESTAMP(timezone=True), server_default=func.transaction_timestamp()) | |
updated_at = Column(TIMESTAMP(timezone=True)) | |
data = Column(JSONB) | |
__table__args__ = Index( | |
"idx_products_title", title, postgresql_using="gin", postgresql_ops={"title": "gin_trgm_ops"} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment