librelist archives

« back to archive

about sqlalchemy

about sqlalchemy

From:
张子腾
Date:
2015-01-13 @ 05:30
hi masters:
    glad to join flask.
   and there are some question about sqlalchemy i still not clear.
   for use sqlalchemy's query object should i must create a model of the 
table at first?? for example,there are table named User and it modeled by 
python class,and then i can use User.query...
   but in fact,in our system,there are many data table wasn't created to a
model in python class.so i only use like db.session.execute(select * from 
...),here no way to use query??or whether there
   are some method to trans an exited table to model so i can use the 
query object???
here they are, wait for some resolusion,thanks

Re: [flask] about sqlalchemy

From:
ydf
Date:
2015-01-13 @ 06:09
我以前处理的有两种方式:
1.直接获取conn, 使用原生的sql。
2. sqlacodegen  批量自动生成model。




------------------ Original ------------------
From: "张子腾"<kaku21@163.com>; 
Date: 2015年1月13日(星期二) 中午1:30
To: "flask"<flask@librelist.com>; 
Subject: [flask] about sqlalchemy



hi masters:
    glad to join flask.
   and there are some question about sqlalchemy i still not clear.
    for use sqlalchemy's query object should i must create a model of the
table at first?? for example,there are table named User and it modeled  by
python class,and then i can use User.query...
   but in fact,in  our system,there are many data table wasn't created to 
a model in python  class.so i only use like db.session.execute(select * 
from ...),here no  way to use query??or whether there 
   are some method to trans an exited table to model so i can use the 
query object???
here they are, wait for some resolusion,thanks

Re: [flask] about sqlalchemy

From:
steve
Date:
2015-01-13 @ 06:44
Hi,In a nutshell, you do need to define the data model in a Class (usually
in app/models.py)
However, you must run:db_create.py
(usually also):db_migrate.py
Steve

Date: Tue, 13 Jan 2015 14:09:55 +0800
From: 85897930@qq.com
Subject: Re:[flask] about sqlalchemy
To: flask@librelist.com

我以前处理的有两种方式:
1.直接获取conn, 使用原生的sql。
2. sqlacodegen  批量自动生成model。


------------------ Original ------------------From: "张子腾"<kaku21@163.com>;
Date: 2015年1月13日(星期二) 中午1:30To: "flask"<flask@librelist.com>; Subject: 
[flask] about sqlalchemy
hi masters:
    glad to join flask.
   and there are some question about sqlalchemy i still not clear.
  
 for use sqlalchemy's query object should i must create a model of the 
table at first?? for example,there are table named User and it modeled 
by python class,and then i can use User.query...
   but in fact,in 
our system,there are many data table wasn't created to a model in python
 class.so i only use like db.session.execute(select * from ...),here no 
way to use query??or whether there 
   are some method to trans an exited table to model so i can use the 
query object???
here they are, wait for some resolusion,thanks