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



##########
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 tried to do changes in teradata.py by moving the code from 
sql_parse file to teradata.py apply_limit_to_sql In base.py file to fetch 
set_or_update_query_limit_td in base.py file
   by modifying the apply_limit_to_sql with exception.
   
   This is not working as teradata file is referring the base file already 
hence both files are referring each other causing the issue.
   
[teradata_modified.txt](https://github.com/apache/superset/files/6500734/teradata_modified.txt)
   
   
   It seems like SQL Lab is hit first which refer base file which finally refer 
sql_parse file, please let me know if this understanding is correct.
   
   
   Please find the attached code for teradata file and let us know what changes 
can be done in files to successfully execute the same.
   




-- 
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