How to make scheduled query in BigQuery less verbose? - google-bigquery

Using the console GUI, I managed to set up jobs to trigger and send an email notification in the event a condition in the data (SQL query) is met.
The email is being sent successfully and the process works as expected, however, when sending the message through Outlook, the email is very verbose and include gibberish that is not needed - is there a way in settings or through code to make the message less verbose ? - see below for reference;
All i need really to display in the email is below yellow highlighted line; thank you

Looks like in the documentation it states that The messages are **not** configurable
https://cloud.google.com/bigquery-transfer/docs/transfer-run-notifications#email_notifications
But as an alternatively, you could publish to a pubsub topic instead. This would allow you to access the full payload and extract the portions you want.
Steps to configure pubsub:
https://cloud.google.com/bigquery-transfer/docs/transfer-run-notifications#notifications
The payload looks like this:
https://cloud.google.com/bigquery-transfer/docs/reference/datatransfer/rest/v1/projects.locations.transferConfigs.runs#TransferRun

Related

Confirming a message in REST - is it PUT or POST?

One of our services generates messages and each message needs to be confirmed. However, the message itself is only identified via it's "type of message", not an ID.
What is the proper HTTP verb for acknowledging the message?
Is it PUT or POST?
If the message does not have a unique ID, then you cannot identify it, so how would you update its status or how do you find it in the database at all? At least generate an MD5 checksum from the JSON representation of the text and other properties md5({message,senderID,receiverID,timestamp,...}). to get an identifier you can use to find the message. After that you can make an endpoint something like /messages/{md5-checksum} and do PUT /messages/{md5-checksum}/confirmed true. You can do POST too POST /messages/{md5-checksum}/confirmation -, but I like PUT better in this scenario.

how to customize notification of control-m?

I want to send a http request to my own applications when job ended ok ?
Is this notification supported by control-m Or Is there any other ways to fulfill my requests?
enter image description here
This is best achieved via the "shout destination" table. Create a shout destination that is of the 'P' type (i.e. program). Point the destination to a simple script that sends a curl instruction to your desired http address.
If you want avoid shout destinations, try using the post-command field in the jobdef but it conditional on the main job working.

How can a Slack app communicate to the user why a slash command failed, and let the user edit the command?

When an app fails to handle a Slack slash command, the text is brought back to allow the user to edit it and immediately send it again. I have a slash-command that searches, but might fail to find any results. In that case, I would like the user to immediately be able to modify their search. The Slack docs explain that I should always return a 200 HTTP status, but then Slack also erases the command and the user can't immediately try again. When I tried to respond with a 404 status, the users get an alarming message like failed with the error "http_client_error". Is there a way to fail but also provide a custom message to the user why?
Yes, but you must not use HTTP status codes to community a failed search.
Just always return HTTP OK 200 and then add a response message telling the user what went wrong. You can do that by directly replying to the request from Slack within 3 seconds, or alternatively by sending a message to the response_url.
This is also clearly expressed in the offical documentation for slash commands:
Sending Error Responses
There are going to be times when you need to let the user know that something went wrong - perhaps the user supplied an incorrect text parameter alongside the command, or maybe there was a failure in an API being used to generate the command response.
It would be tempting in this case to return an HTTP 500 response to
the initial command, but this isn't the right approach. The status
code returned as a response to the command should only be used to
indicate whether or not the request URL successfully received the data
payload - while an error might have occurred in processing and
responding to that payload, the communication itself was still
successful. (Source)
As far as I know it is not possible to signal Slack that the user should be able to edit his last command though.

Capture start of long running POST VB.net MVC4

I have a subroutine in my Controller
<HttpPost>
Sub Index(Id, varLotsOfData)
'Point B.
'By the time it gets here - all the data has been accepted by server.
What I would like to do it capture the Id of the inbound POST and mark, for example, a database record to say "Id xx is receiving data"
The POST receive can take a long time as there is lots of data.
When execution gets to point B I can mark the record "All data received".
Where can I place this type of "pre-POST completed" code?
I should add - we are receiving the POST data from clients that we do not control - that is, it is most likely a client's server sending the data - not a webbrowser client that we have served up from our webserver.
UPDATE: This is looking more complex than I had imagined.
I'm thinking that a possible solution would be to inspect the worker processes in IIS programatically. Via the IIS Manager you can do this for example - How to use IIS Manager to get Worker Processes (w3wp.exe) details information ?
From your description, you want to display on the client page that the method is executing and you can show also a loading gif, and when the execution completed, you will show a message to the user that the execution is completed.
The answer is simply: use SignalR
here you can find some references
Getting started with signalR 1.x and Mvc4
Creating your first SignalR hub MVC project
Hope this will help you
If I understand your goal correctly, it sounds like HttpRequest.GetBufferlessInputStream might be worth a look. It allows you to begin acting on incoming post data immediately and in "pieces" rather than waiting until the entire post has been received.
An excerpt from Microsoft's documentation:
...provides an alternative to using the InputStream propertywhich waits until the whole request has been received. In contrast, the GetBufferlessInputStream method returns the Stream object immediately. You can use the method to begin processing the entity body before the complete contents of the body have been received and asynchronously read the request entity in chunks. This method can be useful if the request is uploading a large file and you want to begin accessing the file contents before the upload is finished.
So you could grab the beginning of the post, and provided your client-facing page sends the ID towards the beginning of its transmission, you may be able to pull that out. Of course, this would be reading raw byte data which would need to be decoded so you could grab the inbound post's ID. There's also a buffered one that will allow the stream to be read in pieces but will also build a complete request object for processing once it has been completely received.
Create a custom action filter,
Action Filters for executing filtering logic either before or after an action method is called. Action Filters are custom attributes that provide declarative means to add pre-action and post-action behavior to the controller's action methods.
Specifically you'll want to look at the
OnActionExecuted – This method is called after a controller action is executed.
Here are a couple of links:
http://www.infragistics.com/community/blogs/dhananjay_kumar/archive/2016/03/04/how-to-create-a-custom-action-filter-in-asp-net-mvc.aspx
http://www.asp.net/mvc/overview/older-versions-1/controllers-and-routing/understanding-action-filters-vb
Here is a lab, but I think it's C#
http://www.asp.net/mvc/overview/older-versions/hands-on-labs/aspnet-mvc-4-custom-action-filters

Use variable in a Parse Push message

I really like the Parse push service and integrated it with our CMS. I would like to make the notifications personal by adding the users name in the push message. How can i use a variable (Named 'voornaam' in the screenshot) which is stored in the Installation class in a push message?
If you are looking for something like a message template like
Hello ${username}, what's up
sadly its not there. One way you can make the kind of message you want to is by doing it in your server side code before you send the request for PUSH using the REST or other APIs