[英]Sql statement to SQLAlchemy
How can I convert this SQL statement into SQLAlchemy python.如何将此 SQL 语句转换为 SQLAlchemy python。 Couldnt find any solution yet
还没有找到任何解决方案
Thanks in advance提前致谢
select date_add(est_date, interval -WEEKDAY(est_date) day) FirstDayOfWeek
Tried this below query but didn't work func.dateadd(est_date, func.dayofweek(est_date), Interval()))
尝试了以下查询但没有工作
func.dateadd(est_date, func.dayofweek(est_date), Interval()))
How about:怎么样:
engine = sqlalchemy.create_engine(
"mssql+pyodbc://"+user+":"+pwd+"@"+HOST+"/" + db + "?driver=SQL+Server+Native+Client+11.0?trusted_connection=yes",
echo=False, fast_executemany=True)
query_read = "select date_add(est_date, interval -WEEKDAY(est_date) day) FirstDayOfWeek"
with engine.begin() as conn:
dfData_old = pd.read_sql(query_read, conn)
Replace PWD, DB, and HOST with your values将 PWD、DB 和 HOST 替换为您的值
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.