kameshkotwani commented on issue #27077:
URL: https://github.com/apache/airflow/issues/27077#issuecomment-1280864106

   There is a python function which creates the file, here is the code:
   ```python
   def _fetch_pageviews(pagenames,execution_date,**_):
       result = dict.fromkeys(pagenames,0)
       with 
open(f"/opt/airflow/dags/wikipageviews{execution_date.hour}{execution_date.day}",'r')
 as f:
           for line in f:
               domain_code,page_title,view_counts,_ = line.split(" ")
               if domain_code == "en" and page_title in pagenames:
                   result[page_title] = view_counts
       
       with open(f"/opt/airflow/dags/queries{execution_date.hour}{ 
execution_date.day }.sql",'w') as f:
           for pagename,pageviewcount in result.items():
               f.write(
                   f"INSERT INTO pageview_counts VALUES ('{pagename}' 
,{pageviewcount}, '{execution_date}' );\n"
               )
   
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to