Schema for SQLite usage on this bot.
rpcope1 opened this issue · 2 comments
Hi,
After reading some comments on Reddit, it sounded like there might be some interest in helping clean up SnapshillBot a little bit. One of things I did notice was that SQLite is used, but I don't see a schema anywhere. Did I miss something, or maybe someone can provide a schema? If there's some interest, I know some buttcoiners were interested in a few things, such as being able to load quotes directly from the repository as an option. Is there a wishlist anywhere for SnapshillBot?
Thanks,
Robert
Hi there,
I don't think there's a wishlist other than GitHub issues. Snapshillbot only uses a single table links with textfields id and reply.
If you got any other questions I'm happy to help.
Op 7 feb. 2016 om 09:30 heeft Robert P. Cope notifications@github.com het volgende geschreven:
Hi,
After reading some comments on Reddit, it sounded like there might be some interest in helping clean up SnapshillBot a little bit. One of things I did notice was that SQLite is used, but I don't see a schema anywhere. Did I miss something, or maybe someone can provide a schema? If there's some interest, I know some buttcoiners were interested in a few things, such as being able to load quotes directly from the repository as an option. Is there a wishlist anywhere for SnapshillBot?
Thanks,
Robert—
Reply to this email directly or view it on GitHub.
I'm using the following, maybe it's worth adding something like this?
db = sqlite3.connect(DB_FILE)
cur = db.cursor()
HASLINKS = "SELECT name FROM sqlite_master WHERE type='table' AND name='links';"
if cur.execute(HASLINKS):
log.info('Found table "links" in db %s.' % DB_FILE)
else:
cur.execute('CREATE TABLE links (id TEXT PRIMARY KEY, reply TEXT)')
log.info('Created table "links" in db %s.' % DB_FILE)