Kanaries / pygwalker

PyGWalker: Turn your pandas dataframe into an interactive UI for visual analysis
https://kanaries.net/pygwalker
Apache License 2.0
12.85k stars 664 forks source link

[BUG] Reporting syntax error when connecting to MySQL #496

Closed KamiPasi closed 5 months ago

KamiPasi commented 6 months ago
from pygwalker.data_parsers.database_parser import Connector
import os
import pygwalker as pyg
conn = Connector(
    os.environ.get('ENGINE_RDS').format('sihe_dwd'),
    """
        SELECT
            *
        FROM
            dm_qbi_tm_gmv_daily limit 100
    """
)
walker = pyg.walk(conn)

image

(pymysql.err.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(ROUND((`min_bin_id` + (LEAST(FLOOR(((`id` - `min_bin_id`) / ((`max_bin_id` - `m' at line 1") [SQL: SELECT ARRAY(ROUND((`min_bin_id` + (LEAST(FLOOR(((`id` - `min_bin_id`) / ((`max_bin_id` - `min_bin_id`) / 10.0))), 9) * ((`max_bin_id` - `min_bin_id`) / 10.0))), `round_bin_id`), ROUND((`min_bin_id` + (LEAST(FLOOR((((`id` - `min_bin_id`) / ((`max_bin_id` - `min_bin_id`) / 10.0)) + 1)), 10) * ((`max_bin_id` - `min_bin_id`) / 10.0))), `round_bin_id`)) AS `bin_id`, SUM(1) AS `gw_count_fid_sum` FROM (SELECT * FROM (SELECT *, CAST(GREATEST(LEAST(2 - ROUND((LOG(10, MAX(`id`) OVER () - MIN(`id`) OVER ()))), 100), 0) AS SIGNED) AS `round_bin_id`, MIN(`id`) OVER () AS `min_bin_id`, MAX(`id`) OVER () AS `max_bin_id` FROM (SELECT * FROM dm_qbi_tm_gmv_daily LIMIT 100) AS temp_view_name) AS `k6s_inner_table`) AS `k6s_base_table` GROUP BY `bin_id`] (Background on this error at: https://sqlalche.me/e/14/f405)
longxiaofei commented 6 months ago

@KamiPasi Thanks for feedback.

Which version of mysql are you using?

Pygwalker needs to make some SQL compatibility according to the database version.

longxiaofei commented 6 months ago

Hi, @KamiPasi

A pre-release version will be released today to fix this bug.

longxiaofei commented 6 months ago

pip install pygwalker==0.4.8a6

fixed it.