aman091291 commented on a change in pull request #13519:
URL: https://github.com/apache/superset/pull/13519#discussion_r636011706



##########
File path: superset/db_engine_specs/base.py
##########
@@ -456,9 +424,15 @@ def apply_limit_to_sql(cls, sql: str, limit: int, 
database: "Database") -> str:
             )
             return database.compile_sqla_query(qry)
 
-        if cls.limit_method == LimitMethod.FORCE_LIMIT:
-            parsed_query = sql_parse.ParsedQuery(sql)
-            sql = parsed_query.set_or_update_query_limit(limit)
+        if LimitMethod.FORCE_LIMIT:
+            engine = cls.get_engine(database)
+            url_type = str(engine.url).split(':')[0]
+            parsed_query = sql_parse.ParsedQuery(sql, uri_type = url_type)
+            print(dir(engine.url))
+            if url_type in ['teradatasql','teradata']:
+                sql = parsed_query.set_or_update_query_limit_td(limit)

Review comment:
       We have done minimal changes in code for SQL_Parse and Base File only 
creating functions (set_or_update_query_limit_td, extract_limit_from_query_td) 
in SQL_Parse and slight modification mentioned below in apply_limit_to_sql to 
call set_or_update_query_limit_td.
   
   We have also tested the same and it looks good by limiting the rows in SQL 
LAB.
   
   This changes are required as new function if passed in Teradata file cannot 
be called in Base due to files calling each other.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to