Hasura session variable as parameter in posgtgress function - postgresql

In hasura you can use column presets to automatically populate table column with value from the jwt token. However I have a scenario where I don't want to directly write the session into the column but instead pass it down as a parameter of a custom postgress function I wrote which returns the correct value that should be used by default.
But I have no idea how to pass hasura session variable as the function parameter, or if even hasura supports that.
So how do I pass say 'x-hasura-user-id' as parameter of get_value() custom function?

Related

Additional Column in ADF through HTTP linked service

I would like to add an additional column during a copy activity. I cannot use the Getmetadata activity because it is through a hhtp linked service.
However, I am using a parameter called filename in order to specify the file. Would it be possible to input the above parameter in the additional column.
enter image description here
You cannot view the Dataset parameter in the pipeline directly.
Alternately you can use a pipeline parameter to provide input to Dataset parameter and use the same pipeline parameter in the Additional Column value.

Query configuration table as a one time activity in Azure Data Factory

Is there a way to query a DB table as a one time activity, so that the values can be used to drive a repeating pipeline activity.
Let's say I have a set of values that varies based on the environment(DEV/TEST/PROD). Instead of passing the values corresponding to the environment as parameters, can I configure these values in a DB table and read them the first time the Data Factory runs, so that a repeating Orchestrator task that runs every five minutes can fetch value obtained from the table?
You can use a Lookup activity for your case.
Specify your query in the Lookup activity to get the row you want to query for your environment value. You may also wants to check the "First row only" option for your case.
To access the value returned from DB, you can get the value from the output of the Lookup. It would be in the "firstRow" object of the output.
For the conditional/switch handling for your use case, put in #activity('Lookup config table').output.firstRow.VALUE for your expression in the Switch's dynamic content.
you can use lookup activity from azure data factory to query values from db and then use parameters to store them to use in next activities, please check this

How can I use TaggedValues within a DDL script?

I'd like to generate table creation code for my data model. This works great, I have changed the default DDL templates.
Now I have a feature which can be set or not for a table (TemporalTable). This in turn will generate different DDL (sql) code based on the TaggedValue value.
How can I access a TaggedValue from a table within the DDL template script?
What you are looking for is described in the help here
For a user defined tagged value on a table that would be:
tableUserProperty:"propertyName"
Returns the value for the
user-defined property in the repository's version of the current
Table.
Parameters
propertyName - the property name that is to be retrieved
Remarks
None.

Provide general query statement for all particular events

the following real use case, that already has been implemented by our company:
We've built application with rest api as wrapper around esper java api.
The user can define it's map schema and query statement.
Each event (instanceof MapEventBean) sent by user (as JSON) has one common parameter (thou with different values every time), which are to be added to map in background to the user map event as additional key-value pair.
Problem: in order to retrieve this additional parameter by UpdateListener, the user defined both schema and query statement are to be extended programmatically over this attribute.
E.g.:
User defined schema: create map schema Name as (...)
Prog. modified schema: create map schema Name as (additionalAttribute Map, ...)
User defined query stmt: select foo, bar from Name
Prog. modified query stmt: select additionalAttribute, foo, bar from Name
Question: approach does work, but is very error-prone or not too independent, as we'd like to have it.
So the question: Is any possibility to define common query stmt (e.g. select additionalAttribute on each event ...) or tell update listener to retrieve the particular attribute on each succeeded query, independently of whether it has been defined in user defined stmt or not.
Thanks in advance!
Update:
I've already considered some possibilities such as NamedWindows, but the problem is, that this additional attributes are to belong to each particular event, - that is the attributes should be fetched from pattern by update listener simultaneously with the event self.
There is a statement object model API that you can use to modify the queries without doing string manipulation. The documentation link for the API is http://esper.espertech.com/release-8.0.0/reference-esper/html_single/index.html#apicompiler-soda

JasperServer: using user locale in query for input control

I am looking for a way to use the current user locale information in a sql query for the input control in JasperServer.
More details:
The input query should present a list of values which it obtains via sql query from our database. However, this values depends on the user locale information.
Within the report I can use $P{REPORT_LOCALE} to get the user locale. However, this parameters does not work in the queries used to populate the input controls.
I appreciate every hint.
I actually figured it out how to do it.
My solution: create an invisible input control of type string and assign it to the report. Define a report parameter with the same name and set the default value expression to $P{REPORT_LOCALE}.getLanguage(). By doing that I am able to use the language code of the current user via the input parameter in sql queries.