mirror of
				https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
				synced 2025-11-03 20:27:54 +00:00 
			
		
		
		
	csv_sqlite.py : comment updates
kpi_csv_sq.py : dash runs in a container, need to have a server to access specific data
This commit is contained in:
		@@ -1,8 +1,9 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
'''
 | 
			
		||||
File: will search sub diretories for kpi.csv and place the data into an sqllite database 
 | 
			
		||||
File: will search sub diretories for kpi.csv and place the data into an sqlite database
 | 
			
		||||
 | 
			
		||||
Usage:
 | 
			
		||||
File: will search path recursivly for kpi.csv and place into sqlite database
 | 
			
		||||
Usage: csv_sqlite.py --path <path to directories to traverse> --database <name of database>
 | 
			
		||||
'''
 | 
			
		||||
 | 
			
		||||
import sys
 | 
			
		||||
@@ -43,15 +44,13 @@ class csv_to_sqlite():
 | 
			
		||||
            # load data
 | 
			
		||||
            append_df = pd.read_csv(kpi, sep='\t')
 | 
			
		||||
            df = df.append(append_df, ignore_index=True)
 | 
			
		||||
            #print("df {data}".format(data=df))
 | 
			
		||||
 | 
			
		||||
        # information on sqlite database
 | 
			
		||||
        # https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_sql.html
 | 
			
		||||
 | 
			
		||||
        print(self.database)
 | 
			
		||||
        conn = sqlite3.connect(self.database) 
 | 
			
		||||
        #conn = sqlite3.connect("qa_db") 
 | 
			
		||||
        #df.to_sql("dp_table",conn,if_exists='append')
 | 
			
		||||
        #data may be appended setting if_exists='append'
 | 
			
		||||
        df.to_sql("dp_table",conn,if_exists='replace')
 | 
			
		||||
        conn.close()
 | 
			
		||||
 | 
			
		||||
@@ -61,16 +60,16 @@ def main():
 | 
			
		||||
        prog='csv_sqlite.py',
 | 
			
		||||
        formatter_class=argparse.RawTextHelpFormatter,
 | 
			
		||||
        epilog='''\
 | 
			
		||||
        read kpi.csv into sqlit database:
 | 
			
		||||
            1. Useful Information goes here
 | 
			
		||||
        read kpi.csv into sqlit database
 | 
			
		||||
 | 
			
		||||
            ''',
 | 
			
		||||
        
 | 
			
		||||
        description='''\
 | 
			
		||||
File: will search path recursivly for kpi.csv and place into sqlite database
 | 
			
		||||
Usage: csv_sqlite.py --path <path> --database <name>
 | 
			
		||||
Usage: csv_sqlite.py --path <path to directories to traverse> --database <name of database>
 | 
			
		||||
 | 
			
		||||
        ''')
 | 
			
		||||
    parser.add_argument('--path', help='--path ./path_to_kpi',required=True)
 | 
			
		||||
    parser.add_argument('--path', help='--path ./top directory path to kpi',required=True)
 | 
			
		||||
    parser.add_argument('--file', help='--file kpi.csv',default='kpi.csv')
 | 
			
		||||
    parser.add_argument('--database', help='--database qa_test_db',default='qa_test_db')
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -117,13 +117,15 @@ for test_tag in test_tag_list:
 | 
			
		||||
            #html_src  = os.path.join(kpi_path[0],"index.html")
 | 
			
		||||
            # need to have a share available 
 | 
			
		||||
            #local_share = 'file://LAPTOP-T8B2MBJD/Users/chuck/git/lanforge-scripts/py-scripts/sandbox/lf_check_2'
 | 
			
		||||
            local_share = 'file://LAPTOP-T8B2MBJD/Users/chuck/git/lanforge-scripts/py-scripts/sandbox/'
 | 
			
		||||
            #local_share = 'file://LAPTOP-T8B2MBJD/Users/chuck/git/lanforge-scripts/py-scripts/sandbox/'
 | 
			
		||||
            local_share = 'http:/127.0.0.1:8080/Users/chuck/git/lanforge-scripts/py-scripts/sandbox/'
 | 
			
		||||
 | 
			
		||||
            html_src  = os.path.join(local_share,kpi_path[0],"index.html")
 | 
			
		||||
            #children_div.append(html.A('link{}'.format(i), href='http://192.168.95.6/html-reports/lf_check--2021-08-03-12-47-01.html', target='_blank'))
 | 
			
		||||
            children_div.append(html.A('link{}'.format(i), href='http://192.168.95.6/html-reports/lf_check--2021-08-03-12-47-01.html', target='_blank'))
 | 
			
		||||
            children_div.append(html.Br())
 | 
			
		||||
            children_div.append(html.A(html_src, href=html_src, target='_blank'))
 | 
			
		||||
            #children_div.append(html.Br())
 | 
			
		||||
            #children_div.append(html.A('Navigate to google.com {}'.format(i), href='http://google.com', target='_blank'))
 | 
			
		||||
            children_div.append(html.Br())
 | 
			
		||||
            children_div.append(html.A('Navigate to google.com {}'.format(i), href='http://google.com', target='_blank'))
 | 
			
		||||
            #children_div.append(dcc.Location(id='dog',refresh=False))
 | 
			
		||||
            #children_div.append(dcc.Link('Link', href=html_src, target="_blank" ))
 | 
			
		||||
            # can add other information 
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user