Compatibility with limit for SQL Server
See original GitHub issueWhen query is passed to SQL Server for execution, it includes “limit 200” on the query. However, SQL Server does not like this syntax since T-SQL is not postgres compatible.
It looks like limit is attached here: dbtCommandFactory.ts
try:
import decimal
import json
import re
import sys
import traceback
import orjson
from dbt_osmosis.core.osmosis import DbtOsmosis
runner = DbtOsmosis(
project_dir=r"${projectRoot.fsPath.replace(/"/g, '\\"')}",
target=r"${target.replace(/"/g, '\\"')}",
)
query = """${sql.replace(/"/g, '\\"')}"""
query_with_limit = f"select * from ({query}) as osmosis_query **limit ${limit}**"
result = runner.execute_sql(query_with_limit)
except Exception as exc:
eprint(json_dumps({"message": str(exc), "data": traceback.format_exc()}))
sys.exit(-1)
The fix for SQL Server is detecting when the adapter type is SQL Server and passing the following syntax:
query_with_limit = f"select top ${limit} * from ({query}) as osmosis_query "
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Maximum capacity specifications for SQL Server
This article shows maximum sizes and numbers of various objects defined in SQL Server components, along with additional information.
Read more >Equivalent of LIMIT and OFFSET for SQL Server?
Limit with offset to select 11 to 20 rows in SQL Server: SELECT email FROM emailTable WHERE user_id=3 ORDER BY Id OFFSET ...
Read more >SQL Limit: A Beginner's Guide % - Career Karma
The LIMIT clause is only compatible with the SQL SELECT statement. You cannot use a LIMIT clause on an SQL UPDATE statement, for...
Read more >How to Limit Rows in a SQL Server? - GeeksforGeeks
LIMIT syntax works in MYSQL. In the Microsoft database, we use the below syntax (TOP which works similar to LIMIT in MYSQL) ...
Read more >Using the SQL Limit Clause - YouTube
Learn how to use the SQL Limit Clause to limit the results returned from the MySQL database. This video is from my online...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
its the little things…
You should use