You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
455 B
22 lines
455 B
2 years ago
|
from sqlalchemy import select
|
||
|
from s1_models import *
|
||
|
|
||
|
# 方法1
|
||
|
s1 = select([cookies]) # 2.0废弃
|
||
|
rp1 = connection.execute(s1)
|
||
|
results1 = rp1.fetchall()
|
||
|
print(results1)
|
||
|
|
||
|
# 方法2
|
||
|
s2 = cookies.select()
|
||
|
str(s2)
|
||
|
rp2 = connection.execute(s2)
|
||
|
results2 = rp2.fetchall()
|
||
|
print(results2)
|
||
|
print(results2[0])
|
||
|
first_row = results2[0]
|
||
|
print(first_row[1])
|
||
|
print(first_row.cookie_name)
|
||
|
print(first_row[cookies.c.cookie_name])
|
||
|
results3 = rp2.scalar()
|
||
|
print(results3)
|