I want to store a list of rss feed urls in an sqlite db. I'm using SQLAlchemy and was wondering how to store these. I can't seem to find any documentation about lists, and was wondering if this was legal for a column: Column('rss_feed_urls', List)
Or is there an array type that I could use?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With