mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 08:01:35 +00:00
fix: update ms sql template (#5059)
This commit is contained in:
@@ -923,11 +923,11 @@ SELECT ?;
|
||||
#[test]
|
||||
fn test_parse_mssql_sig() -> anyhow::Result<()> {
|
||||
let code = r#"
|
||||
-- @p1 param1 (int) = 3
|
||||
-- @p2 param2 (varchar)
|
||||
-- @p3 param3 (varchar)
|
||||
SELECT @p3, @p1;
|
||||
SELECT @p2;
|
||||
-- @P1 param1 (int) = 3
|
||||
-- @P2 param2 (varchar)
|
||||
-- @P3 param3 (varchar)
|
||||
SELECT @P3, @P1;
|
||||
SELECT @P2;
|
||||
"#;
|
||||
assert_eq!(
|
||||
parse_mssql_sig(code)?,
|
||||
|
||||
@@ -221,12 +221,12 @@ LIMIT @limit OFFSET @offset;`,
|
||||
SELECT * FROM demo
|
||||
WHERE LENGTH(?) = 0 OR CONCAT("ID") ILIKE CONCAT('%', ?, '%') OR CONCAT("NAME") ILIKE CONCAT('%', ?, '%')
|
||||
LIMIT 100 OFFSET 0`,
|
||||
mssql: `-- @p1 limit (int)
|
||||
-- @p2 offset (int)
|
||||
-- @p3 search (text)
|
||||
SELECT * FROM Demo WHERE (@p3 = '' OR CONCAT([col1], [col2], [col3]) LIKE '%' + @p3 + '%')
|
||||
mssql: `-- @P1 limit (int)
|
||||
-- @P2 offset (int)
|
||||
-- @P3 search (text)
|
||||
SELECT * FROM Demo WHERE (@P3 = '' OR CONCAT([col1], [col2], [col3]) LIKE '%' + @P3 + '%')
|
||||
ORDER BY col1
|
||||
OFFSET @p2 ROWS FETCH NEXT @p1 ROWS ONLY`
|
||||
OFFSET @P2 ROWS FETCH NEXT @P1 ROWS ONLY`
|
||||
},
|
||||
aggridinfinitecomponentee: {
|
||||
deno: `type User = {
|
||||
@@ -341,12 +341,12 @@ LIMIT @limit OFFSET @offset;`,
|
||||
SELECT * FROM demo
|
||||
WHERE LENGTH(?) = 0 OR CONCAT("ID") ILIKE CONCAT('%', ?, '%') OR CONCAT("NAME") ILIKE CONCAT('%', ?, '%')
|
||||
LIMIT 100 OFFSET 0`,
|
||||
mssql: `-- @p1 limit (int)
|
||||
-- @p2 offset (int)
|
||||
-- @p3 search (text)
|
||||
SELECT * FROM Demo WHERE (@p3 = '' OR CONCAT([col1], [col2], [col3]) LIKE '%' + @p3 + '%')
|
||||
mssql: `-- @P1 limit (int)
|
||||
-- @P2 offset (int)
|
||||
-- @P3 search (text)
|
||||
SELECT * FROM Demo WHERE (@P3 = '' OR CONCAT([col1], [col2], [col3]) LIKE '%' + @P3 + '%')
|
||||
ORDER BY col1
|
||||
OFFSET @p2 ROWS FETCH NEXT @p1 ROWS ONLY`
|
||||
OFFSET @P2 ROWS FETCH NEXT @P1 ROWS ONLY`
|
||||
},
|
||||
textcomponent: {
|
||||
deno: `export async function main() {
|
||||
|
||||
@@ -112,7 +112,7 @@ prompts:
|
||||
{code}
|
||||
```
|
||||
<contextual_information>
|
||||
Arguments can be obtained directly in the statement with @p1, @p2, etc.. Name the parameters by adding comments before the statement like that: `-- @p1 name1 ({type})` or `-- @p2 name2 ({type}) = default` (one per row)
|
||||
Arguments can be obtained directly in the statement with @P1, @P2, etc.. Name the parameters by adding comments before the statement like that: `-- @P1 name1 ({type})` or `-- @P2 name2 ({type}) = default` (one per row)
|
||||
</contextual_information>
|
||||
My instructions: {description}
|
||||
graphql:
|
||||
|
||||
@@ -26,7 +26,7 @@ export const EDIT_PROMPT = {
|
||||
"prompt": "Here's my snowflake code: \n```sql\n{code}\n```\n<contextual_information>\nArguments can be obtained directly in the statement with ?. Name the parameters by adding comments before the statement like that: `-- ? name1 ({type})` or `-- ? name2 ({type}) = default` (one per row)\n</contextual_information>\nMy instructions: {description}"
|
||||
},
|
||||
"mssql": {
|
||||
"prompt": "Here's my Microsoft SQL Server code: \n```sql\n{code}\n```\n<contextual_information>\nArguments can be obtained directly in the statement with @p1, @p2, etc.. Name the parameters by adding comments before the statement like that: `-- @p1 name1 ({type})` or `-- @p2 name2 ({type}) = default` (one per row)\n</contextual_information>\nMy instructions: {description}"
|
||||
"prompt": "Here's my Microsoft SQL Server code: \n```sql\n{code}\n```\n<contextual_information>\nArguments can be obtained directly in the statement with @P1, @P2, etc.. Name the parameters by adding comments before the statement like that: `-- @P1 name1 ({type})` or `-- @P2 name2 ({type}) = default` (one per row)\n</contextual_information>\nMy instructions: {description}"
|
||||
},
|
||||
"graphql": {
|
||||
"prompt": "Here's my graphql code: \n```graphql\n{code}\n```\n<contextual_information>\nAdd the needed arguments as query parameters.\n</contextual_information>\nMy instructions: {description}"
|
||||
|
||||
@@ -122,7 +122,7 @@ prompts:
|
||||
{code}
|
||||
```
|
||||
<contextual_information>
|
||||
Arguments can be obtained directly in the statement with @p1, @p2, etc.. Name the parameters by adding comments before the statement like that: `-- @p1 name1 ({type})` or `-- @p2 name2 ({type}) = default` (one per row)
|
||||
Arguments can be obtained directly in the statement with @P1, @P2, etc.. Name the parameters by adding comments before the statement like that: `-- @P1 name1 ({type})` or `-- @P2 name2 ({type}) = default` (one per row)
|
||||
</contextual_information>
|
||||
I get the following error: {error}
|
||||
Fix my code.
|
||||
|
||||
@@ -26,7 +26,7 @@ export const FIX_PROMPT = {
|
||||
"prompt": "Here's my snowflake code: \n```sql\n{code}\n```\n<contextual_information>\nArguments can be obtained directly in the statement with ?. Name the parameters by adding comments before the statement like that: `-- ? name1 ({type})` or `-- ? name2 ({type}) = default` (one per row)\n</contextual_information>\nI get the following error: {error}\nFix my code."
|
||||
},
|
||||
"mssql": {
|
||||
"prompt": "Here's my Microsoft SQL Server code: \n```sql\n{code}\n```\n<contextual_information>\nArguments can be obtained directly in the statement with @p1, @p2, etc.. Name the parameters by adding comments before the statement like that: `-- @p1 name1 ({type})` or `-- @p2 name2 ({type}) = default` (one per row)\n</contextual_information>\nI get the following error: {error}\nFix my code."
|
||||
"prompt": "Here's my Microsoft SQL Server code: \n```sql\n{code}\n```\n<contextual_information>\nArguments can be obtained directly in the statement with @P1, @P2, etc.. Name the parameters by adding comments before the statement like that: `-- @P1 name1 ({type})` or `-- @P2 name2 ({type}) = default` (one per row)\n</contextual_information>\nI get the following error: {error}\nFix my code."
|
||||
},
|
||||
"graphql": {
|
||||
"prompt": "Here's my graphql code: \n```graphql\n{code}\n```\n<contextual_information>\nAdd the needed arguments as query parameters.\n</contextual_information>\nI get the following error: {error}\nFix my code."
|
||||
|
||||
@@ -78,7 +78,7 @@ prompts:
|
||||
mssql:
|
||||
prompt: |-
|
||||
<contextual_information>
|
||||
You have to write a statement for Microsoft SQL Server. Arguments can be obtained directly in the statement with @p1, @p2, etc.. Name the parameters by adding comments before the statement like that: `-- @p1 name1 ({type})` or `-- @p2 name2 ({type}) = default` (one per row)
|
||||
You have to write a statement for Microsoft SQL Server. Arguments can be obtained directly in the statement with @P1, @P2, etc.. Name the parameters by adding comments before the statement like that: `-- @P1 name1 ({type})` or `-- @P2 name2 ({type}) = default` (one per row)
|
||||
</contextual_information>
|
||||
My instructions: {description}
|
||||
graphql:
|
||||
|
||||
@@ -26,7 +26,7 @@ export const GEN_PROMPT = {
|
||||
"prompt": "<contextual_information>\nYou have to write a statement for Snowflake. Arguments can be obtained directly in the statement with ?. Name the parameters by adding comments before the statement like that: `-- ? name1 ({type})` or `-- ? name2 ({type}) = default` (one per row)\n</contextual_information>\nMy instructions: {description}"
|
||||
},
|
||||
"mssql": {
|
||||
"prompt": "<contextual_information>\nYou have to write a statement for Microsoft SQL Server. Arguments can be obtained directly in the statement with @p1, @p2, etc.. Name the parameters by adding comments before the statement like that: `-- @p1 name1 ({type})` or `-- @p2 name2 ({type}) = default` (one per row)\n</contextual_information>\nMy instructions: {description}"
|
||||
"prompt": "<contextual_information>\nYou have to write a statement for Microsoft SQL Server. Arguments can be obtained directly in the statement with @P1, @P2, etc.. Name the parameters by adding comments before the statement like that: `-- @P1 name1 ({type})` or `-- @P2 name2 ({type}) = default` (one per row)\n</contextual_information>\nMy instructions: {description}"
|
||||
},
|
||||
"graphql": {
|
||||
"prompt": "<contextual_information>\nYou have to write a query for GraphQL. Add the needed arguments as query parameters.\n</contextual_information>\nMy instructions: {description}"
|
||||
|
||||
@@ -278,11 +278,11 @@ UPDATE demo SET col2 = ? WHERE col2 = ?;
|
||||
|
||||
const MSSQL_INIT_CODE = `-- return_last_result
|
||||
-- to pin the database use '-- database f/your/path'
|
||||
-- @p1 name1 (varchar) = default arg
|
||||
-- @p2 name2 (int)
|
||||
-- @p3 name3 (int)
|
||||
INSERT INTO demo VALUES (@p1, @p2);
|
||||
UPDATE demo SET col2 = @p3 WHERE col2 = @p2;
|
||||
-- @P1 name1 (varchar) = default arg
|
||||
-- @P2 name2 (int)
|
||||
-- @P3 name3 (int)
|
||||
INSERT INTO demo VALUES (@P1, @P2);
|
||||
UPDATE demo SET col2 = @P3 WHERE col2 = @P2;
|
||||
`
|
||||
|
||||
const GRAPHQL_INIT_CODE = `query($name4: String, $name2: Int, $name3: [String]) {
|
||||
|
||||
Reference in New Issue
Block a user