Giter VIP home page Giter VIP logo

Comments (6)

betodealmeida avatar betodealmeida commented on May 18, 2024 1

I don't think this is something we can fix in Superset, it's not doing anything special with Select queries.

from superset.

berlicon avatar berlicon commented on May 18, 2024 1

@rusackas - I think ticket could be closed. The problem will not be fixed on Superset (#28007 (comment)) neither on ClickHouse (ClickHouse/ClickHouse#62604 (comment)) side. Fortunately we have a workaround.

About Documentation PR... Is this suggestion to me? I think this info is useless on this page. If anyone will have this problem he/she will googling and find this post.

from superset.

berlicon avatar berlicon commented on May 18, 2024

I received workaround for this issue from @den-crane - ClickHouse/ClickHouse#62604 (comment)

TLDR: add sleep(1) to SELECT query. So, instead this "SELECT * FROM t" I should write this: "SELECT sleep(1),* FROM t"

from superset.

berlicon avatar berlicon commented on May 18, 2024

OK, I fixed it with workaround:

  1. in superset/sql_lab.py add this:
    import re -- row №25

sql = add_sleep_to_selects_in_sql(sql) -- row №264 in execute_sql_statement before 'try: query.executed_sql = sql'

def add_sleep_to_selects_in_sql(
    sql: str
) -> str:
    if (    (re.search(r"\bINSERT\b", sql, flags=re.IGNORECASE) == None) 
        and (re.search(r"\bUPDATE\b", sql, flags=re.IGNORECASE) == None) 
        and (re.search(r"\bDELETE\b", sql, flags=re.IGNORECASE) == None)):
        return re.sub(r"\bSELECT\b", "SELECT sleep(1), ", sql, flags=re.IGNORECASE)

    return sql
-- row №324
  1. in superset/result_set.py add this:
            if "sleep(1)" in column_names:
                column_names.remove("sleep(1)")
                for i, s in enumerate(data):
                    data[i] = s[1:]

-- row №123 in class SupersetResultSet before comment '# fix cursor descriptor with the deduped names'

from superset.

rusackas avatar rusackas commented on May 18, 2024

If we have a workaround and can't fix this in Superset, we should probably close it. Before I/we do, would anyone want to open a Documentation PR (or at least suggestion) on this page to help others?

from superset.

rusackas avatar rusackas commented on May 18, 2024

Right @berlicon - I think you (or anyone who understands this issue) would be helping others by making a change on that page, if it's "useless". The more we document rather than have people go fishing through issues, the better.

from superset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.