insights icon indicating copy to clipboard operation
insights copied to clipboard

Issue in connecting Database

Open chechani opened this issue 2 years ago • 4 comments

I am getting issue in connecting an erpnext site database.

ERPNext v14 beta5 Frappe V14 beta 4 while adding database, I am getting below error

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 67, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 39, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 77, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1502, in call
    return fn(*args, **newargs)
  File "apps/insights/insights/api/onboarding.py", line 41, in add_database
    data_source.save()
  File "apps/frappe/frappe/model/document.py", line 288, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 310, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 268, in insert
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1071, in run_post_save_methods
    self.run_method("on_update")
  File "apps/frappe/frappe/model/document.py", line 912, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1251, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1233, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 909, in fn
    return method_object(*args, **kwargs)
  File "apps/insights/insights/insights/doctype/data_source/data_source.py", line 26, in on_update
    self.import_tables()
  File "apps/insights/insights/insights/doctype/data_source/data_source.py", line 133, in import_tables
    table_links = self.get_foreign_key_constraints()
  File "apps/insights/insights/insights/doctype/data_source/data_source.py", line 213, in get_foreign_key_constraints
    return self.build_frappe_constraints()
  File "apps/insights/insights/insights/doctype/data_source/data_source.py", line 232, in build_frappe_constraints
    standard_links = self.execute_query(query, as_dict=1)
  File "apps/insights/insights/insights/doctype/data_source/data_source.py", line 88, in execute_query
    result = db.sql(query, **kwargs)
  File "apps/frappe/frappe/database/database.py", line 175, in sql
    self._cursor.execute(query)
  File "env/lib/python3.8/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "env/lib/python3.8/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.8/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.8/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.8/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.ProgrammingError: (1146, "Table 'frappe.tabDocField' doesn't exist")

chechani avatar Aug 16 '22 12:08 chechani

Hi,

Even I am getting an issue while trying to connect the database. It says no database selected even though I have correctly put in all the fields and the connection is successfully established.

Traceback (most recent call last):
  File "apps/insights/insights/insights/doctype/data_source/data_source.py", line 411, in connect_to_db
    yield db
  File "apps/insights/insights/insights/doctype/data_source/data_source.py", line 88, in execute_query
    result = db.sql(query, **kwargs)
  File "apps/frappe/frappe/database/database.py", line 209, in sql
    self._cursor.execute(query, values)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "env/lib/python3.10/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 548, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 775, in _read_query_result
    result.read()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 1156, in read
    first_packet = self.connection._read_packet()
  File "env/lib/python3.10/site-packages/pymysql/connections.py", line 725, in _read_packet
    packet.raise_for_error()
  File "env/lib/python3.10/site-packages/pymysql/protocol.py", line 221, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "env/lib/python3.10/site-packages/pymysql/err.py", line 143, in raise_mysql_exception
    raise errorclass(errno, errval)
pymysql.err.OperationalError: (1046, 'No database selected')

shashankshirke avatar Aug 19 '22 22:08 shashankshirke

Hi,

Even I am getting an issue while trying to connect the database. It says no database selected even though I have correctly put in all the fields and the connection is successfully established.

This is a known issue, check this comment for a solution https://github.com/frappe/insights/issues/5#issuecomment-1207186953

nextchamp-saqib avatar Aug 20 '22 06:08 nextchamp-saqib

I am getting issue in connecting an erpnext site database.

ERPNext v14 beta5 Frappe V14 beta 4 while adding database, I am getting below error

I am not 100% sure but this looks like a problem with frappe framework installation. Can you try uninstalling "insights" and then migrating your site and then installing "insights"?

nextchamp-saqib avatar Aug 20 '22 06:08 nextchamp-saqib

I am getting issue in connecting an erpnext site database. ERPNext v14 beta5 Frappe V14 beta 4 while adding database, I am getting below error

I am not 100% sure but this looks like a problem with frappe framework installation. Can you try uninstalling "insights" and then migrating your site and then installing "insights"?

Tried what you sugessted, but getting same error.

chechani avatar Aug 20 '22 07:08 chechani

Its resolved

chechani avatar Oct 18 '22 02:10 chechani