Using list as a data type in a column (SQLAlchemy)

If you really must you could use the PickleType. But what you probably want is another table (which consists of a list of rows, right?). Just create a table to hold your RSS feeds:

class RssFeed(Base):
    __tablename__ = 'rssfeeds'
    id = Column(Integer, primary_key=True)
    url = Column(String)

Add new urls:

feed = RssFeed(url="http://url/for/feed")
session.add(feed)

Retrieve your list of urls:

session.query(RssFeed).all()

Find a specific feed by index:

session.query(RssFeed).get(1)

I’d recommend SQLAlchemy’s Object Relational Tutorial.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)