Redshift Query Syntax error (using SQL Workbench): Is there an easy way to go directly to the "position" mentioned in the error? - position

Is there an easy way to go directly to the position mentioned in an error message in SQL Workbench/Redshift (error provided below the code)? Thanks!
Here is the error:
An error occurred when executing the SQL command:
select
application_id,
case when stage_name in (
'Application Review',
'New Lead',
'Recruiter Review',
'Reached Out', ...
Amazon Invalid operation: syntax error at or near ")"
Position: 201; [SQL State=42601, DB Errorcode=500310] 1 statement
failed.
Execution time: 0.16s
Here's the Query:
select
application_id,
case when stage_name in (
'Application Review',
'New Lead',
'Recruiter Review',
'Reached Out',
'Make Decision',
'Resume Review',
) then 'Application Review'
when stage_name in ('Preliminary Phone Screen', 'Recruiter Screen','Handoff','Researcher Screen','Exploratory') then 'Recruiter Screen'
when stage_name in (
'Phone Interview',
'Phone Interview 2'
'Phone Interview #1',
'Phone Interview #2',
'Phone/Initial Interview #1',
'Phone/Initial Interview #2',
'Hiring Manager Review',
'Hiring Manager Screen',
'Final Interview',
'Take Home Test',
'Initial Interview')
then 'Initial Interview'
when stage_name in
( 'Onsite Interview #1',
'Face to Face',
'Face to Face 2',
'Onsite Interview #2',
'Onsite Interview')
then 'Onsite Interview'
when stage_name = 'Homework' then 'Homework' when stage_name in
( 'Post Onsite',
'Reference Check',
'Hiring Review',
'Hiring Review Debrief',
'Hiring Review/Debrief',
'Post Hiring Review / Debrief',
'Post Hiring Review/Post Debrief',
'Hiring Review / Debrief',
'Post Hiring Review / Post Debrief',
'Team Match')
then 'Post Onsite'
when stage_name = 'Byteboard Interview' then 'Byteboard Interview'
when stage_name IN ('Filtered','Filtered.ai Matching') then 'Filtered'
when stage_name = 'HackerRank Test' then 'HackerRank Test'
when stage_name = 'ClassMarker' then 'ClassMarker'
when stage_name = 'Offer' then 'Offer'
else 'Other' end as app_Stage_Name_group,
min(entered_on) as entered_on,
max(exited_on) as exited_on
from
application_stages
where
entered_on is not null
group by
1,
2

If you are using Build 125, you can configure this through workbench.settings by using the same settings that are used for Postgres to identify the error position.
Edit the file with a regular text editor and add these two lines:
workbench.db.redshift.errorinfo.regex.position=(?i)position:\\s+[0-9]+
workbench.db.redshift.errorinfo.leading.comment.included=true
Then the cursor should automatically jump to the position in the editor identified by the error message.
The settings file is located in the configuration directory. The exact location is shown in the about dialog and the options dialog.
Make sure you close SQL Workbench/J before editing the file.

Related

queryText being sent to Dialogflow is not the original user query

The user input / queryText being sent to Dialogflow is not the expected, original user query.
simulator query manipulation
I enabled "Log interactions to Google Cloud" in my Dialogflow project's settings. What I'm seeing is multiple "assistant_action" resources before the actual request that goes to DF. In the example above, this is what I see:
GCP logs
With the first debug resource showing post data with:
"inputs":[{"rawInputs":[{"inputType":"UNSPECIFIED_INPUT_TYPE","query":"how long has it been on the market"}]
And
resource: {
type: "assistant_action"
labels: {
project_id: "<MY-PROJECT-ID>"
version_id: ""
action_id: ""
}
},
timestamp: "2021-03-05T18:41:44.142202856Z"
severity: "DEBUG"
labels: {
channel: "production"
querystream: "GOOGLE_USER"
source: "AOG_REQUEST_RESPONSE"
}
The subsequent requests are the same but with modified input queries ("how long has it been on the market" -> "how long has something been on the market" -> "how long has us FDA been on the market"), the last one being the actual user query sent, the channel being preview and the action_id "actions.intent.TEXT".
resource: {
type: "assistant_action"
labels: {
project_id: "<MY-PROJECT-ID>"
version_id: ""
action_id: "actions.intent.TEXT"
}
},
timestamp: "2021-03-05T18:41:45.942019959Z"
severity: "DEBUG"
labels: {
channel: "preview"
querystream: "GOOGLE_USER"
source: "AOG_REQUEST_RESPONSE"
}
I should note that I am testing current drafts of an AoG project and have no releases let alone a production release. I have a denied beta, because of branding issues which I address with separate AoG/DF projects for PROD. I do not have any intents enabled for slot filling or any required entity parameters. This is just one example, but I have been noticing many occurrences of this issue.
What is happening here? Why is the original user input being manipulated? What are all these interactions we are seeing before the expected request/response cycle?
After having contacted someone at Google Cloud, I was informed this was something that had been raised by others and that AoG devs were looking into it.
As of a Mar 24 2021 release, I can no longer replicate this Entity Resolution issue.

Cannot get generated express code (from OpenAPI) to catch error in query parameters

I’m trying to get the generated code (express.js) from isa-group/oas-tools to check the input url, but I’m having no luck. (Or am I abusing the tool?!) It seems to ignore errors in the query parameters. For example, I don’t get an error sending this url:
http://localhost:8080/acQyreXchange/acQyr-sample/1.0.0/gamer/123?limit=-3&xyz=a
I would expect it to complain about ‘limit’ being out of range (-3 < 0), and ‘xyz’ being an unknown parameter. I get an error message about wrong data in the response (which I’m expecting), but nothing about the inputs. Here's the response:
[
• {
o message: "Wrong data in the response. ",
o error:
[
 {
 code: "INVALID_TYPE",
 params:
[
 "array",
 "object"
],
 message: "Expected type array but found type object",
 path: "#/"
}
],
o content:
{
 message: "This is the mockup controller for getGamer"
}
• }
]
The debug log shows:
2020-09-01T14:49:11.670Z info: Requested method-url pair: get - /acQyreXchange/acQyr-sample/1.0.0/gamer/123?limit=-3&xyz=a
2020-09-01T14:49:11.671Z debug: OASValidator -res.locals.requestedSpecPath: /gamer/{gamerId}
2020-09-01T14:49:11.673Z info: Valid parameter on request
2020-09-01T14:49:11.675Z debug: Processing at checkResponse:
...
The api doc shows:
'/gamer/{gamerId}':
get:
tags:
- admins
summary: 'given a gamerId, returns a gamer'
operationId: getGamer
description: Returns a gamer
parameters:
- in: path
name: gamerId
description: pass the gamerId for looking up the gamer
required: true
schema:
type: string
- in: query
name: skip
description: number of records to skip for pagination
schema:
type: integer
format: int32
minimum: 0
- in: query
name: limit
description: maximum number of records to return
schema:
type: integer
format: int32
minimum: 0
maximum: 50
responses:
'200':
description: search results matching criteria
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Gamer'
'400':
description: bad input parameter
I’ve tried option:
strict: true (also tried false)
validator: true (also tried false)
customErrorHandling: true (also tried false)
The owner of the code said he's put this fix in asap.

Iterating on jade-Array of objects

Please help me in iterating the following array of objects. I'm able see the array of objects in console,But I could not iterate it in jade
[{title: "Stamp. The Hobbit", description: "Stamp. <b>The Hobbit</b>. I know
it was on Friday …n the day when there was not a lot of creativity.",
originalLink: null, summary: null, date: "2017-09-25T06:42:50.000Z"}
{title: "Fall/winter Tolkien/LOTR events: your 'go-to' list",
description: "Audiences will thrill to the music from his legend…bbit</b>
with scores from his films: The ...", originalLink: null, summary:
null, date: "2017-09-25T05:26:15.000Z"},
{title: "Watch what happens when Darth Vader swaps galaxy far, far away ...
for Middle Earth", description: "The narrative of Middle Earth: Shadow of
War is ba…nts of <b>The Hobbit</b> and The Lord of ...", originalLink:
null, summary: null, date: "2017-09-25T03:56:15.000Z"}
{title: "The hobbit sword", description: "Posted by alex in kids / baby
stuff, toys in Munster, Cork. 24 September 2017...210966215.", originalLink:
null, summary: null, date: "2017-09-24T19:30:12.000Z"}
{title: "The hobbit as high fantasy essay", description: "Im science teacher
is stupid hes making me write a… like r u serious. Problems of urbanization
essay", originalLink: null, summary: null, date: "2017-09-24T19:26:02.000Z"}
{title: "Lego The Hobbit Bagend Bundle", description: "Lego <b>The
Hobbit</b> Bagend Bundle, Used Lego &a…, Dublin, Ireland for 130.00 euros on
Adverts.ie.", originalLink: null, summary: null, date: "2017-09-
24T10:42:38.000Z"}]
server code:
res.render('index', { aaa: JSON.stringify(result) });
jade :
extends layout
block content
script.
console.log("hi");
var bbb = !{aaa}
console.log(bbb)
each value in bbb
p= value.title
I think you just have to set value.title like this :
each value in bbb
p !{value.title}
Hope it helps.

Can you add separators to dropdown menus in activeadmin

Is there a way to add separators to a dropdown menu in activeadmin?
For example, if I wanted a separator between the first and second items, how can I do that?
menu.add label: 'Tasks', priority: 10 do |tasks|
tasks.add label: 'Add News Item',
url: proc { new_feed_path },
if: proc { authorized? :create, Feed },
priority: 14
tasks.add label: 'Add Calendar Event',
url: proc { new_event_path },
if: proc { authorized? :create, Event },
priority: 15
end
I checked the documentation but don't seem to see anything for that.
As of writing this comment, ActiveAdmin is at version 1.2.1 and based on its code, it isn't possible to add separators/dividers in a dropdown menu. :(
I just checked on the Github repo and they have no opened issue nor pull request matching the "separator" or "divider" keywords.
Maybe the first step would be to open an issue describing what and how to implement it.
Nothing is preventing us from adding a divider manually:
menu.add label: 'Tasks', priority: 10 do |tasks|
tasks.add label: 'Add News Item',
url: proc { new_feed_path },
if: proc { authorized? :create, Feed },
priority: 14
tasks.add label: "<hr>".html_safe,
url: "javascript:void(0)",
priority: 15
tasks.add label: 'Add Calendar Event',
url: proc { new_event_path },
if: proc { authorized? :create, Event },
priority: 16
end
a url attribute is required so using javascript:void(0) is an option here as # will not render the label. This question discusses javascript:void(0)

How to remove default links on navigation bar and change their order

As title,
I want to remove the default links assets, comments
and change the remaining links order, how to do it ? thanks
In initializers/active_admin.rb
config.comments_menu = false
That will remove comments from the menu.
If you want to customize the menu further, remove assets, or keep comments and move them to a dropdown you can build a menu. Just omit any label that you'd like hidden from the menu.
config.comments_menu = false
#....
config.namespace :admin do |admin|
admin.build_menu do |menu|
menu.add label: 'Dashboard', priority: 0
menu.add label: 'Revenue', priority: 3
menu.add label: 'Costs', priority: 4
menu.add label: 'Categories', priority: 5
menu.add label: 'Users & Comments', priority: 6
menu.add label: 'Comments', parent: 'Users & Comments', url: "/admin/comments"
end
end

Resources