sql server - Looping through SQLDW table with Python -
i have table in microsoft azure sqldw has date field, other columns. there row each day in past 10 years of business days. table has not been stored in such way "order date" etc. below code have far:
import pyodbc driver = '{odbc driver 13 sql server}' conn = pyodbc.connect('driver='+driver+'; port=1433;server='+server+'; database='+database+'; uid='+username+'; pwd='+ password) cursor = conn.cursor() cursor.execute("select * index_att") = 0 row in cursor: += 1 print(i) if i'm using python loop through every row in table , want go in chronological order (from oldest date current date) table need stored in way ordered date? , need add additional incremental id starts @ 1 oldest date , goes each day?
or there way loop through dates data not sorted?
currently table has not been stored in such way "order date" etc.
how data stored irrelevant. if want ordered data, client needs request order by clause on select query.
Comments
Post a Comment