I have created a table (MySQL 5.1)
from sqlalchemy import *
def get():
db = create_engine('mysql://user:password@localhost/database')
db.echo = True
metadata = MetaData(db)
feeds = Table('feeds', metadata,
Column('id', Integer, primary_key=True),
Column('title', String(100)),
Column('link', String(255)),
Column('description', String(255)),
)
entries = Table('entries', metadata,
Column('id', Integer, primary_key=True),
Column('fid', Integer),
Column('url', String(255)),
Column('title', String(255)),
Column('content', String(5000)),
Column('date', DateTime),
)
feeds.create()
entries.create()
But when I try to query it:
from sqlalchemy import *
db = create_engine('mysql://user:password@localhost/database')
metadata = MetaData(db)
feeds = Table('feeds', metadata)
s = feeds.select()
result = db.execute(s)
I get an error on the result = db.execute(s) line indicating the following:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM feeds' at line 2") 'SELECT \nFROM feeds' ()
I'm obviously new to SQLAlchemy, and I have no idea what I'm doing wrong, despite having googled every tutorial on the web and changed this a million times. Any help?