First time here? Check out the Help page!
1 | initial version |
Here's some Python code that connects to the SQL database, queries it for the End Uses table, and writes it to a CSV file.
import os
import numpy as np
import pandas as pd
import sqlite3
sql_dir = r'C:\Users\Matt\Documents\WORKING\14038 NIST\14038-Baseline\run\6-EnergyPlus-0'
sql_file = 'eplusout.sql'
sql_path = os.path.join(sql_dir, sql_file)
print sql_path
write_dir = sql_dir
# Connect an create a cursor
conn = sqlite3.connect(sql_path)
#Create a cursor and return the list of all tables in the database
c = conn.cursor()
query = "SELECT * FROM TabularDataWithStrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' AND TableName='End Uses'"
end_uses = pd.read_sql(query, conn)
end_uses.to_csv(os.path.join(write_dir, 'SQL-EndUses.csv'), index=False)
end_uses
2 | No.2 Revision |
Here's some old Python code that connects to the SQL database, queries it for the End Uses table, and writes it to a CSV file.
import os
import numpy as np
import pandas as pd
import sqlite3
sql_dir = r'C:\Users\Matt\Documents\WORKING\14038 NIST\14038-Baseline\run\6-EnergyPlus-0'
sql_file = 'eplusout.sql'
sql_path = os.path.join(sql_dir, sql_file)
print sql_path
write_dir = sql_dir
# Connect an create a cursor
conn = sqlite3.connect(sql_path)
#Create a cursor and return the list of all tables in the database
c = conn.cursor()
query = "SELECT * FROM TabularDataWithStrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' AND TableName='End Uses'"
end_uses = pd.read_sql(query, conn)
end_uses.to_csv(os.path.join(write_dir, 'SQL-EndUses.csv'), index=False)
end_uses
3 | No.3 Revision |
Here's some old Python code that I had in a Jupyter notebook that connects to the SQL database, queries it for the End Uses table, and writes it to a CSV file.
# In[1]:
import os
import numpy as np
import pandas as pd
import sqlite3
# In[2]:
sql_dir = r'C:\Users\Matt\Documents\WORKING\14038 NIST\14038-Baseline\run\6-EnergyPlus-0'
sql_file = 'eplusout.sql'
sql_path = os.path.join(sql_dir, sql_file)
print sql_path
write_dir = sql_dir
# In[3]:
# Connect an create a cursor
conn = sqlite3.connect(sql_path)
#Create a cursor and return the list of all tables in the database
c = conn.cursor()
# In[4]:
query = "SELECT * FROM TabularDataWithStrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' AND TableName='End Uses'"
end_uses = pd.read_sql(query, conn)
pd.read_sql(query ,conn)
end_uses.to_csv(os.path.join(write_dir, 'SQL-EndUses.csv'), index=False)
end_uses
4 | No.4 Revision |
Here's some old Python code that I had in a Jupyter notebook that connects to the SQL database, queries it for the End Uses table, and writes it to a CSV file.
# In[1]:
import os
import numpy as np
import pandas as pd
import sqlite3
# In[2]:
sql_dir = r'C:\Users\Matt\Documents\WORKING\14038 NIST\14038-Baseline\run\6-EnergyPlus-0'
sql_file = 'eplusout.sql'
sql_path = os.path.join(sql_dir, sql_file)
print sql_path
write_dir = sql_dir
# In[3]:
# Connect an create a cursor
conn = sqlite3.connect(sql_path)
#Create a cursor and return the list of all tables in the database
c = conn.cursor()
# In[4]:
query = "SELECT * FROM TabularDataWithStrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' AND TableName='End Uses'"
end_uses = pd.read_sql(query ,conn)
end_uses.to_csv(os.path.join(write_dir, 'SQL-EndUses.csv'), index=False)
end_uses