我創建了一個表(MySQL 5.1中)SQLAlchemy的Select語句 - SQL語法錯誤
from sqlalchemy import *
def get():
db = create_engine('mysql://user:[email protected]/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()
但是當我嘗試進行查詢:
from sqlalchemy import *
db = create_engine('mysql://user:[email protected]/database')
metadata = MetaData(db)
feeds = Table('feeds', metadata)
s = feeds.select()
result = db.execute(s)
我得到的結果的誤差= DB .execute(S)線指示如下:
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'()
我顯然新SQLAlchemy的,我不知道我做錯了,儘管HAV在網絡上搜索每一個教程並改變了這一百萬次。任何幫助?
任何進度?如果您不迴應我們的第一條建議,我們無法真正幫助您。 – ssokolow 2010-09-20 09:44:05