insights icon indicating copy to clipboard operation
insights copied to clipboard

Unable to modify limit in Table Chart

Open zaheer-srushty opened this issue 1 year ago • 3 comments

By default, the Table Chart displays 100 rows. It is not showing the entire row result. If the limit is increased, then anl SQL error is raised.

Screenshot_20241022-135008

This gives a SELECT error whereas I was thinking the SQL syntax should be applying the LIMIT keyword.

zaheer-srushty avatar Oct 22 '24 08:10 zaheer-srushty

I can't replicate the issue. The limit is applied correctly. Can you share the chart options that you have set?

nextchamp-saqib avatar Oct 24 '24 11:10 nextchamp-saqib

Here's the chart options

image

zaheer-srushty avatar Oct 24 '24 11:10 zaheer-srushty

It works for me with the same options, can you try creating a new table chart with the same options and check if you can replicate it again?

nextchamp-saqib avatar Oct 26 '24 06:10 nextchamp-saqib

hi, @nextchamp-saqib I’m having a same problem with the limit value. When I increase or decrease it from 100

~/development$ bench version
frappe 15.x.x-develop
insights 3.0.2
Error Log
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `su...' at line 1")
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/app.py", line 118, in application
    response = frappe.api.handle(request)
      request = <Request 'http://server.localhost/api/method/insights.api.workbooks.fetch_query_results' [POST]>
      response = None
      rollback = True
      e = ProgrammingError(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `su...' at line 1")
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
      request = <Request 'http://server.localhost/api/method/insights.api.workbooks.fetch_query_results' [POST]>
      endpoint = <function handle_rpc_call at 0x72d727f4cb80>
      arguments = {'method': 'insights.api.workbooks.fetch_query_results'}
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
      method = 'insights.api.workbooks.fetch_query_results'
      frappe = <module 'frappe' from 'apps/frappe/frappe/__init__.py'>
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
      cmd = 'insights.api.workbooks.fetch_query_results'
      data = None
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
      cmd = 'insights.api.workbooks.fetch_query_results'
      from_async = False
      server_script = None
      method = <function fetch_query_results at 0x72d70eda6840>
  File "apps/frappe/frappe/__init__.py", line 1807, in call
    return fn(*args, **newargs)
      fn = <function fetch_query_results at 0x72d70eda6840>
      args = ()
      kwargs = {'use_live_connection': True, 'operations': [{'table': {'data_source': 'distribution', 'table_name': 'tabPrice List', 'type': 'table'}, 'type': 'source'}, {'column_names': ['name'], 'type': 'select'}, {'join_condition': {'left_column': {'column_name': 'name', 'type': 'column'}, 'right_column': {'column_name': 'price_list', 'type': 'column'}}, 'join_type': 'left', 'select_columns': [{'column_name': 'item_code', 'type': 'column'}, {'column_name': 'price_list_rate', 'type': 'column'}], 'table': {'data_source': 'distributin', 'table_name': 'tabItem Price', 'type': 'table'}, 'type': 'join'}, {'filters': [{'column': {'column_name': 'price_list', 'type': 'column'}, 'operator': 'in', 'value': ['Wholesale Selling Price']}], 'logical_operator': 'And', 'type': 'filter_group'}, {'type': 'summarize', 'measures': [{'aggregation': 'sum', 'column_name': 'price_list_rate', 'data_type': 'Decimal', 'label': 'sum(price_list_rate)', 'measure_name': 'sum(price_list_rate)', 'valu...
      newargs = {'use_live_connection': True, 'operations': [{'table': {'data_source': 'distribution', 'table_name': 'tabPrice List', 'type': 'table'}, 'type': 'source'}, {'column_names': ['name'], 'type': 'select'}, {'join_condition': {'left_column': {'column_name': 'name', 'type': 'column'}, 'right_column': {'column_name': 'price_list', 'type': 'column'}}, 'join_type': 'left', 'select_columns': [{'column_name': 'item_code', 'type': 'column'}, {'column_name': 'price_list_rate', 'type': 'column'}], 'table': {'data_source': 'distribution', 'table_name': 'tabItem Price', 'type': 'table'}, 'type': 'join'}, {'filters': [{'column': {'column_name': 'price_list', 'type': 'column'}, 'operator': 'in', 'value': ['Wholesale Selling Price']}], 'logical_operator': 'And', 'type': 'filter_group'}, {'type': 'summarize', 'measures': [{'aggregation': 'sum', 'column_name': 'price_list_rate', 'data_type': 'Decimal', 'label': 'sum(price_list_rate)', 'measure_name': 'sum(price_list_rate)', 'valu...
  File "apps/frappe/frappe/utils/typing_validations.py", line 32, in wrapper
    return func(*args, **kwargs)
      args = ()
      kwargs = {'use_live_connection': True, 'operations': [{'table': {'data_source': 'distribution', 'table_name': 'tabPrice List', 'type': 'table'}, 'type': 'source'}, {'column_names': ['name'], 'type': 'select'}, {'join_condition': {'left_column': {'column_name': 'name', 'type': 'column'}, 'right_column': {'column_name': 'price_list', 'type': 'column'}}, 'join_type': 'left', 'select_columns': [{'column_name': 'item_code', 'type': 'column'}, {'column_name': 'price_list_rate', 'type': 'column'}], 'table': {'data_source': 'distribution', 'table_name': 'tabItem Price', 'type': 'table'}, 'type': 'join'}, {'filters': [{'column': {'column_name': 'price_list', 'type': 'column'}, 'operator': 'in', 'value': ['Wholesale Selling Price']}], 'logical_operator': 'And', 'type': 'filter_group'}, {'type': 'summarize', 'measures': [{'aggregation': 'sum', 'column_name': 'price_list_rate', 'data_type': 'Decimal', 'label': 'sum(price_list_rate)', 'measure_name': 'sum(price_list_rate)', 'valu...
      apply_condition = <function whitelist.<locals>.innerfn.<locals>.<lambda> at 0x72d70eda6660>
      func = <function insights_whitelist.<locals>.decorator.<locals>.wrapper at 0x72d70eda67a0>
  File "apps/insights/insights/decorators.py", line 18, in wrapper
    return function(*args, **kwargs)
      args = ()
      kwargs = {'use_live_connection': True, 'operations': [{'table': {'data_source': 'distribution', 'table_name': 'tabPrice List', 'type': 'table'}, 'type': 'source'}, {'column_names': ['name'], 'type': 'select'}, {'join_condition': {'left_column': {'column_name': 'name', 'type': 'column'}, 'right_column': {'column_name': 'price_list', 'type': 'column'}}, 'join_type': 'left', 'select_columns': [{'column_name': 'item_code', 'type': 'column'}, {'column_name': 'price_list_rate', 'type': 'column'}], 'table': {'data_source': 'distribution', 'table_name': 'tabItem Price', 'type': 'table'}, 'type': 'join'}, {'filters': [{'column': {'column_name': 'price_list', 'type': 'column'}, 'operator': 'in', 'value': ['Wholesale Selling Price']}], 'logical_operator': 'And', 'type': 'filter_group'}, {'type': 'summarize', 'measures': [{'aggregation': 'sum', 'column_name': 'price_list_rate', 'data_type': 'Decimal', 'label': 'sum(price_list_rate)', 'measure_name': 'sum(price_list_rate)', 'valu...
      function = <function insights_whitelist.<locals>.decorator.<locals>.wrapper at 0x72d70eda6700>
      role = 'Insights User'
  File "apps/insights/insights/decorators.py", line 167, in wrapper
    return function(*args, **kwargs)
      args = ()
      kwargs = {'use_live_connection': True, 'operations': [{'table': {'data_source': 'distribution', 'table_name': 'tabPrice List', 'type': 'table'}, 'type': 'source'}, {'column_names': ['name'], 'type': 'select'}, {'join_condition': {'left_column': {'column_name': 'name', 'type': 'column'}, 'right_column': {'column_name': 'price_list', 'type': 'column'}}, 'join_type': 'left', 'select_columns': [{'column_name': 'item_code', 'type': 'column'}, {'column_name': 'price_list_rate', 'type': 'column'}], 'table': {'data_source': 'distribution', 'table_name': 'tabItem Price', 'type': 'table'}, 'type': 'join'}, {'filters': [{'column': {'column_name': 'price_list', 'type': 'column'}, 'operator': 'in', 'value': ['Wholesale Selling Price']}], 'logical_operator': 'And', 'type': 'filter_group'}, {'type': 'summarize', 'measures': [{'aggregation': 'sum', 'column_name': 'price_list_rate', 'data_type': 'Decimal', 'label': 'sum(price_list_rate)', 'measure_name': 'sum(price_list_rate)', 'valu...
      function = <function fetch_query_results at 0x72d70eda62a0>
  File "apps/insights/insights/api/workbooks.py", line 22, in fetch_query_results
    results = execute_ibis_query(ibis_query, limit=limit, cache_expiry=60 * 10)
      operations = [{'table': {'data_source': 'distribution', 'table_name': 'tabPrice List', 'type': 'table'}, 'type': 'source'}, {'column_names': ['name'], 'type': 'select'}, {'join_condition': {'left_column': {'column_name': 'name', 'type': 'column'}, 'right_column': {'column_name': 'price_list', 'type': 'column'}}, 'join_type': 'left', 'select_columns': [{'column_name': 'item_code', 'type': 'column'}, {'column_name': 'price_list_rate', 'type': 'column'}], 'table': {'data_source': 'distribution', 'table_name': 'tabItem Price', 'type': 'table'}, 'type': 'join'}, {'filters': [{'column': {'column_name': 'price_list', 'type': 'column'}, 'operator': 'in', 'value': ['Wholesale Selling Price']}], 'logical_operator': 'And', 'type': 'filter_group'}, {'type': 'summarize', 'measures': [{'aggregation': 'sum', 'column_name': 'price_list_rate', 'data_type': 'Decimal', 'label': 'sum(price_list_rate)', 'measure_name': 'sum(price_list_rate)', 'value': 'sum(price_list_rate)'}], 'dimensions': ...
      limit = '1000'
      use_live_connection = True
      results = []
      ibis_query = r0 := DatabaseTable: tabPrice List
        name                    !string
        creation                timestamp(6)
        modified                timestamp(6)
        modified_by             string
        owner                   string
        docstatus               !int32
        idx                     !int32
        enabled                 !int32
        price_list_name         string
        currency                string
        buying                  !int32
        selling                 !int32
        price_not_uom_dependent !int32
        _user_tags              string
        _comments               string
        _assign                 string
        _liked_by               string
      
      r1 := DatabaseTable: tabItem Price
        name             !string
        creation         timestamp(6)
        modified         timestamp(6)
        modified_by      string
        owner            string
        docstatus        !int32
        idx              !int32
        item_code        string
        uom              string
        packing_unit     !int32
        item_name        string
        brand            string
        item_description string
        pr...
      columns = [{'name': 'item_code', 'type': 'String'}, {'name': 'sum(price_list_rate)', 'type': 'Decimal'}]
  File "apps/insights/insights/insights/doctype/insights_data_source_v3/ibis_utils.py", line 516, in execute_ibis_query
    res: pd.DataFrame = query.execute()
      query = r0 := DatabaseTable: tabPrice List
        name                    !string
        creation                timestamp(6)
        modified                timestamp(6)
        modified_by             string
        owner                   string
        docstatus               !int32
        idx                     !int32
        enabled                 !int32
        price_list_name         string
        currency                string
        buying                  !int32
        selling                 !int32
        price_not_uom_dependent !int32
        _user_tags              string
        _comments               string
        _assign                 string
        _liked_by               string
      
      r1 := DatabaseTable: tabItem Price
        name             !string
        creation         timestamp(6)
        modified         timestamp(6)
        modified_by      string
        owner            string
        docstatus        !int32
        idx              !int32
        item_code        string
        uom              string
        packing_unit     !int32
        item_name        string
        brand            string
        item_description string
        pr...
      limit = 1000
      cache = True
      cache_expiry = 600
      sql = SQLString("SELECT\n  *\nFROM (\n  SELECT\n    `t7`.`item_code`,\n    SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)`\n  FROM (\n    SELECT\n      *\n    FROM (\n      SELECT\n        `t4`.`name`,\n        `t5`.`price_list`,\n        `t5`.`price_list_rate`,\n        `t5`.`item_code`\n      FROM (\n        SELECT\n          `t0`.`name`\n        FROM `tabPrice List` AS `t0`\n      ) AS `t4`\n      LEFT OUTER JOIN (\n        SELECT\n          `t1`.`price_list`,\n          `t1`.`price_list_rate`,\n          `t1`.`item_code`\n        FROM `tabItem Price` AS `t1`\n      ) AS `t5`\n        ON CAST(`t4`.`name` AS BINARY) = `t5`.`price_list`\n    ) AS `t6`\n    WHERE\n      `t6`.`price_list` IN ('Wholesale Selling Price')\n  ) AS `t7`\n  GROUP BY\n    1\n  LIMIT (\n    SELECT\n      1000\n    FROM (\n      SELECT\n        `t7`.`item_code`,\n        SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)`\n      FROM (\n        SELECT\n          *\n        FROM (\n          SELECT\n            ...
      start = 295269.928820334
  File "env/lib/python3.12/site-packages/ibis/expr/types/core.py", line 396, in execute
    return self._find_backend(use_default=True).execute(
      self = r0 := DatabaseTable: tabPrice List
        name                    !string
        creation                timestamp(6)
        modified                timestamp(6)
        modified_by             string
        owner                   string
        docstatus               !int32
        idx                     !int32
        enabled                 !int32
        price_list_name         string
        currency                string
        buying                  !int32
        selling                 !int32
        price_not_uom_dependent !int32
        _user_tags              string
        _comments               string
        _assign                 string
        _liked_by               string
      
      r1 := DatabaseTable: tabItem Price
        name             !string
        creation         timestamp(6)
        modified         timestamp(6)
        modified_by      string
        owner            string
        docstatus        !int32
        idx              !int32
        item_code        string
        uom              string
        packing_unit     !int32
        item_name        string
        brand            string
        item_description string
        pr...
      limit = 'default'
      params = None
      kwargs = {}
  File "env/lib/python3.12/site-packages/ibis/backends/mysql/__init__.py", line 375, in execute
    with self._safe_raw_sql(sql) as cur:
      self = <ibis.backends.mysql.Backend object at 0x72d70db76360>
      expr = r0 := DatabaseTable: tabPrice List
        name                    !string
        creation                timestamp(6)
        modified                timestamp(6)
        modified_by             string
        owner                   string
        docstatus               !int32
        idx                     !int32
        enabled                 !int32
        price_list_name         string
        currency                string
        buying                  !int32
        selling                 !int32
        price_not_uom_dependent !int32
        _user_tags              string
        _comments               string
        _assign                 string
        _liked_by               string
      
      r1 := DatabaseTable: tabItem Price
        name             !string
        creation         timestamp(6)
        modified         timestamp(6)
        modified_by      string
        owner            string
        docstatus        !int32
        idx              !int32
        item_code        string
        uom              string
        packing_unit     !int32
        item_name        string
        brand            string
        item_description string
        pr...
      limit = 'default'
      kwargs = {'params': None}
      table = r0 := DatabaseTable: tabPrice List
        name                    !string
        creation                timestamp(6)
        modified                timestamp(6)
        modified_by             string
        owner                   string
        docstatus               !int32
        idx                     !int32
        enabled                 !int32
        price_list_name         string
        currency                string
        buying                  !int32
        selling                 !int32
        price_not_uom_dependent !int32
        _user_tags              string
        _comments               string
        _assign                 string
        _liked_by               string
      
      r1 := DatabaseTable: tabItem Price
        name             !string
        creation         timestamp(6)
        modified         timestamp(6)
        modified_by      string
        owner            string
        docstatus        !int32
        idx              !int32
        item_code        string
        uom              string
        packing_unit     !int32
        item_name        string
        brand            string
        item_description string
        pr...
      sql = "SELECT * FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON CAST(`t4`.`name` AS BINARY) = `t5`.`price_list`) AS `t6` WHERE `t6`.`price_list` IN ('Wholesale Selling Price')) AS `t7` GROUP BY 1 LIMIT (SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON `t5`.`price_list` = CAST(`t4`.`name` AS BINARY)) AS `t6` WHERE `t6`.`price_list` IN ('Wholes...
      schema = ibis.Schema {
        item_code             string
        sum(price_list_rate)  decimal(38, 9)
      }
  File "/usr/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
      self = <contextlib._GeneratorContextManager object at 0x72d70e2cc110>
  File "env/lib/python3.12/site-packages/ibis/backends/mysql/__init__.py", line 270, in _safe_raw_sql
    with contextlib.closing(self.raw_sql(*args, **kwargs)) as result:
      self = <ibis.backends.mysql.Backend object at 0x72d70db76360>
      args = ("SELECT * FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON CAST(`t4`.`name` AS BINARY) = `t5`.`price_list`) AS `t6` WHERE `t6`.`price_list` IN ('Wholesale Selling Price')) AS `t7` GROUP BY 1 LIMIT (SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON `t5`.`price_list` = CAST(`t4`.`name` AS BINARY)) AS `t6` WHERE `t6`.`price_list` IN ('Whole...
      kwargs = {}
  File "env/lib/python3.12/site-packages/ibis/backends/mysql/__init__.py", line 281, in raw_sql
    cursor.execute(query, **kwargs)
      self = <ibis.backends.mysql.Backend object at 0x72d70db76360>
      query = "SELECT * FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON CAST(`t4`.`name` AS BINARY) = `t5`.`price_list`) AS `t6` WHERE `t6`.`price_list` IN ('Wholesale Selling Price')) AS `t7` GROUP BY 1 LIMIT (SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON `t5`.`price_list` = CAST(`t4`.`name` AS BINARY)) AS `t6` WHERE `t6`.`price_list` IN ('Wholes...
      kwargs = {}
      con = <pymysql.connections.Connection object at 0x72d70db76660>
      cursor = <pymysql.cursors.Cursor object at 0x72d70ea45130>
  File "env/lib/python3.12/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
      self = <pymysql.cursors.Cursor object at 0x72d70ea45130>
      query = "SELECT * FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON CAST(`t4`.`name` AS BINARY) = `t5`.`price_list`) AS `t6` WHERE `t6`.`price_list` IN ('Wholesale Selling Price')) AS `t7` GROUP BY 1 LIMIT (SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON `t5`.`price_list` = CAST(`t4`.`name` AS BINARY)) AS `t6` WHERE `t6`.`price_list` IN ('Wholes...
      args = None
  File "env/lib/python3.12/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
      self = <pymysql.cursors.Cursor object at 0x72d70ea45130>
      q = "SELECT * FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON CAST(`t4`.`name` AS BINARY) = `t5`.`price_list`) AS `t6` WHERE `t6`.`price_list` IN ('Wholesale Selling Price')) AS `t7` GROUP BY 1 LIMIT (SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON `t5`.`price_list` = CAST(`t4`.`name` AS BINARY)) AS `t6` WHERE `t6`.`price_list` IN ('Wholes...
      conn = <pymysql.connections.Connection object at 0x72d70db76660>
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 563, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
      self = <pymysql.connections.Connection object at 0x72d70db76660>
      sql = b"SELECT * FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON CAST(`t4`.`name` AS BINARY) = `t5`.`price_list`) AS `t6` WHERE `t6`.`price_list` IN ('Wholesale Selling Price')) AS `t7` GROUP BY 1 LIMIT (SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `sum(price_list_rate)` FROM (SELECT * FROM (SELECT `t4`.`name`, `t5`.`price_list`, `t5`.`price_list_rate`, `t5`.`item_code` FROM (SELECT `t0`.`name` FROM `tabPrice List` AS `t0`) AS `t4` LEFT OUTER JOIN (SELECT `t1`.`price_list`, `t1`.`price_list_rate`, `t1`.`item_code` FROM `tabItem Price` AS `t1`) AS `t5` ON `t5`.`price_list` = CAST(`t4`.`name` AS BINARY)) AS `t6` WHERE `t6`.`price_list` IN ('Whole...
      unbuffered = False
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 825, in _read_query_result
    result.read()
      self = <pymysql.connections.Connection object at 0x72d70db76660>
      unbuffered = False
      result = <pymysql.connections.MySQLResult object at 0x72d70ea46f30>
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 1199, in read
    first_packet = self.connection._read_packet()
      self = <pymysql.connections.MySQLResult object at 0x72d70ea46f30>
  File "env/lib/python3.12/site-packages/pymysql/connections.py", line 775, in _read_packet
    packet.raise_for_error()
      self = <pymysql.connections.Connection object at 0x72d70db76660>
      packet_type = <class 'pymysql.protocol.MysqlPacket'>
      buff = bytearray(b"\xff(\x04#42000You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \'(SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `su...\' at line 1")
      packet_header = b'\xed\x00\x00\x01'
      btrl = 237
      btrh = 0
      packet_number = 1
      bytes_to_read = 237
      recv_data = b"\xff(\x04#42000You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `su...' at line 1"
      packet = <pymysql.protocol.MysqlPacket object at 0x72d70ed148e0>
  File "env/lib/python3.12/site-packages/pymysql/protocol.py", line 219, in raise_for_error
    err.raise_mysql_exception(self._data)
      self = <pymysql.protocol.MysqlPacket object at 0x72d70ed148e0>
      errno = 1064
  File "env/lib/python3.12/site-packages/pymysql/err.py", line 150, in raise_mysql_exception
    raise errorclass(errno, errval)
      data = b"\xff(\x04#42000You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `su...' at line 1"
      errno = 1064
      errval = "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `su...' at line 1"
      errorclass = <class 'pymysql.err.ProgrammingError'>
pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(SELECT 1000 FROM (SELECT `t7`.`item_code`, SUM(`t7`.`price_list_rate`) AS `su...' at line 1")

donnieferdian avatar Nov 08 '24 19:11 donnieferdian

Should be fixed with 6ddbb9580b447376c27af464e5b38aa6e99d9bfd (v3.0.6)

nextchamp-saqib avatar Nov 20 '24 07:11 nextchamp-saqib