Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

python - SQLAlchemy order_by returning numbers based on first number instead of the whole number

I'm building a web app using Python and SQLAlchemy.

I'm using the following code to retrieve records.

yardDB.query.order_by(yardDB.PIT.asc())

It is returning records based on the ascending order in my "PIT" column, but it's not returning it in the way I need it to. (Green highlight in picture below)

*Note, the Seq column is not the same as the green column. Also the green column is hidden, but I unhid it to see how it's returning the records.

Picture of how it's returning records

I need it to simply return the rows like 1, 2, 3, .... 10, 11, ... 20, 21, ...

Edit: Listing things I've tried with no success.

  • Changed my PIT column data type to Integer and String
  • Added leading 00's
  • Took off ascending order of query being made.

yardDB.query.order_by(yardDB.PIT)

question from:https://stackoverflow.com/questions/65945431/sqlalchemy-order-by-returning-numbers-based-on-first-number-instead-of-the-whole

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...