QUERY无法在AZURE CLOUD KUDU APP服务中使用,但是当我从本地计算机运行时可以使用

时间:2019-07-12 17:00:55

标签: python cloud kudu axure

我正在webjobs / KUDU / AZURE CLOUD APP SERVICES中运行SQL SERVER查询。它不起作用,并且基本上没有将数据提取到文件中。当我在本地计算机上运行相同的代码时,它可以工作。有任何想法吗?以下是查询。

cursor = cnxn.cursor()
print('testing...')
currentdate=time.strftime('%Y%m%d')
print('current date:',currentdate)
yesterday=datetime.strftime(datetime.now() - timedelta(1), '%Y%m%d')
print('yesterday date:', yesterday)
cursor.execute ("SELECT sa.TXN_NO,cu.CustomerNumber,cu.NAME1 as Customer_Name,cu.ShippingConditionsText,\
sa.STLMNT_DT as SettlementDate,\
p.PackUPC,p.MaterialNumber,p.MaterialDescription,\
     sa.CSE_VOL,\
     p.PhysicalStateDesc,p.UnitedPackageDescription,p.BeverageProductDesc,p.SellableUnit,sa.UsageIndicatorDescription\
     FROM V_ALL_OI_PI_IP_SETTLED_SALES sa, V_CUSTOMER cu,V_PRODUCT p WHERE\
                sa.OUT_ID_SK=cu.OUT_ID_SK\
            AND sa.ART_ID_SK=p.ART_ID_SK AND sa.STLMNT_DT BETWEEN ? AND ? AND (cu.SuppressionReason='' OR cu.SuppressionReason IS NULL) AND cu.OUT_ID IN (500232106, 600023776,500406899,500903620,\
     600022720,500265625,600032237,500398184,500434839,600027798,600027798,600028276,500399408,600026280,600028281,500618425,500240037,500401804,500401902,\
         600024376,600027484,600031917,600023676,500265562,500568631,600028194,600028320,600033731,600025071,500429771,600024053,600031888,500733216,600022568,\
             600026449,600034318,600031892,500317131,500346627,600022650,600025749,600318383,600318382,600307686,500927965,600307685,600314492,600317736,\
                 600314556,600306012,600306015,600306016,600306019,600306020,600306106,600306223,600306896,600310000,600318194,600310006,600310061,\
                     600310002,600310001,600306078,600306079,600318535,600310060,600307712,601067438,601049625,500586743,601085405,601086691,601043326,\
                         601049077,601067765,601067766,601067768,601067770,601083818,601084747,601088095,601049298,601058857,601067767,601082383,601086395,601086710,601067769,601049753);",(yesterday, currentdate))
print('Cursor execute complete')   

将查询结果写入AZURE云本地本地文件,然后写入SFTP。

0 个答案:

没有答案