Skip to content

Database connection #1

@mioruggieroguida

Description

@mioruggieroguida

Hi,

not sure if this repo is still maintened, but i was looking at it as the base for the implmentation of the crrem methodology in our app (https://www.mapmortar.io/). The licence seems to allow it.

When trying the CVAR jupyter notebook I receive this error

could not translate host name "golden-source-2020.cyozpdhauzu4.us-east-2.rds.amazonaws.com" to address: nodename nor servname provided, or not known

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [1], in <cell line: 6>()
      4 from matplotlib import style
      5 style.use('ggplot')
----> 6 from crrem.database import DataQ
      7 import datetime
      8 import warnings

File ~/devmio/crrem/package-crrem-master/crrem/__init__.py:2, in <module>
----> 2 from crrem.var import Building, Portfolio

File ~/devmio/crrem/package-crrem-master/crrem/var.py:12, in <module>
      9 warnings.filterwarnings("ignore")
     11 #impport raw data
---> 12 target_level = DataQ("select * from crrem.target_levels").data
     13 target_type = DataQ("select * from crrem.target_type").data
     14 property_type = DataQ("select * from crrem.vw_epc_to_crrem_prop_type").data

File ~/devmio/crrem/package-crrem-master/crrem/database.py:15, in DataQ.__init__(self, query, db, server, user, pwd)
     13 self.pwd        = pwd
     14 self.conn       = self.db_connect()
---> 15 self.data       = pd.read_sql(self.query, self.conn)
     16 self.describe   = self.data.describe()
     17 self.head       = self.data.head(10)

File ~/devmio/crrem/venv/lib/python3.10/site-packages/pandas/io/sql.py:567, in read_sql(sql, con, index_col, coerce_float, params, parse_dates, columns, chunksize)
    564 pandas_sql = pandasSQL_builder(con)
    566 if isinstance(pandas_sql, SQLiteDatabase):
--> 567     return pandas_sql.read_query(
    568         sql,
    569         index_col=index_col,
    570         params=params,
    571         coerce_float=coerce_float,
    572         parse_dates=parse_dates,
    573         chunksize=chunksize,
    574     )
    576 try:
    577     _is_table_name = pandas_sql.has_table(sql)

File ~/devmio/crrem/venv/lib/python3.10/site-packages/pandas/io/sql.py:2083, in SQLiteDatabase.read_query(self, sql, index_col, coerce_float, params, parse_dates, chunksize, dtype)
   2071 def read_query(
   2072     self,
   2073     sql,
   (...)
   2079     dtype: DtypeArg | None = None,
   2080 ):
   2082     args = _convert_params(sql, params)
-> 2083     cursor = self.execute(*args)
   2084     columns = [col_desc[0] for col_desc in cursor.description]
   2086     if chunksize is not None:


```File ~/devmio/crrem/venv/lib/python3.10/site-packages/pandas/io/sql.py:2021, in SQLiteDatabase.execute(self, *args, **kwargs)
   2020 def execute(self, *args, **kwargs):
-> 2021     cur = self.con.cursor()
   2022     try:
   2023         cur.execute(*args, **kwargs)

AttributeError: 'NoneType' object has no attribute 'cursor'

that I am guessing is related to the database having been changed or deleted. If that is the case would you be able to provide some help? I would be of course happy to deploy a new database on our servers, but I would need to know the schema and how to populate it.

Thanks a lot
Ruggiero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions