Azure data factory data flow expression builder - azure-data-flow

Trying to pull data from source using query:
concat('select column_name from {$trytable} where table_name =',$scddimname)
Both parameters declared and value assigned as:
scddimname string 'emp_scd'
trytable string'INFORMATION_SCHEMA.COLUMNS'
But, error
Error:
DF-DSL-001 - DSL stream has parsing errors
Line 9 Position 86: token recognition error at: '\n' - RunId: e93f18d2-cc0d-4b64-8336-15e75a5aaa22
Looks troubling!

Related

Akka-http: Illegal URI reference: Invalid input ':'

I would like to make http request to a website, where format is like https://abcde-abcde.abcde.abcde.abcde.abcde.com/abcde and I am ending up getting following error for the following code.
import akka.http.scaladsl.client.RequestBuilding.Get
val url = "https://abcde-abcde.abcde.abcde.abcde.abcde.com/abcde"
val getData = Get(url)
error message:
"message":"Illegal URI reference: Invalid input ':', expected 'EOI', '#', '?', !':' or slashSegments (line 1, column 7): \"https://abcde-abcde.abcde.abcde.abcde.abcde.com/abcde\n ^"
Can somebody help me what is wrong with this piece of code. I am just simply doing this https://doc.akka.io/docs/akka-http/current/client-side/request-and-response.html
** UPDATE **
instead of passing url like Get(url), I wrote whole string
like Get("https://abcde-abcde.abcde.abcde.abcde.abcde.com/abcde") , and it worked. I think somehow string re-eval is the problem. Any idea ?

Boto3 Write to DynamoDB from AWS Glue, Unhashable Type: 'dict'

I am attempting to use the boto3 module in PySpark (AWS Glue ETL job) to load a dataframe into DynamoDB but am being met with the error:
Parameter validation failed: Invalid type for parameter Item, value: set(["{u'ecosystemName': u'animals', u'regionalCenter': u'center', u'dataExtractedTimestamp': u'20190502T13:12:11.111Z'}"]), type: <type 'set'>, valid types: <type 'dict'> Could not write to the Audit Table for regional center:
Can anyone please help me resolve this issue and explain why it is happening? I'd like to understand the root of the issue.
Here is my current code. Please note that there will ever only be a single row in this data frame. The SQL used below is fake data for testing only.
try:
timestamp_sql = """select
'animals' as ecosystemName,
'20190502T13:12:11.111Z' as dataExtractedTimestamp,
'center' as regionalCenter
"""
# Make a data frame from SQL
audit_data_frame=spark.sql(timestamp_sql)
# Write the joined dynamic frame out to a datasink
dynamodb = boto3.resource('dynamodb','us-west-2')
table = dynamodb.Table(args['DynamoDBTable2Name'])
audit_data_frame_prep = json.loads(audit_data_frame.toJSON().first())
print(audit_data_frame_prep)
table.put_item( Item = { "{}".format(audit_data_frame_prep) } )
print('Audit trail successfully written for ' + regional_center + '.')
except Exception as e:
print(e)
print('Could not write to the Audit Table for regional center: ' + regional_center + '.')
pass
Dang, 5 minute rule strikes again...
It was in my put_item call. I had the extra brackets there, effectively rendering the JSON invalid. This change solves my issue:
table.put_item( Item = audit_data_frame_prep )

How to pass a null value received on msg.req.query to msg.payload

I am developing an application using Dashdb on Bluemix and nodered, my PHP application uses the call to webservice to invoke the node-red, whenever my function on PHP invokes the node to insert on table and the field GEO_ID is null, the application fails, I understand the issue, it seems the third parameter was not informed, I have just tried to check the param before and passing something like NULL but it continues not working.
See the code:
msg.account_id = msg.req.query.account_id;
msg.user_id = msg.req.query.user_id;
msg.geo_id=msg.req.query.geo_id;
msg.payload = "INSERT INTO ACCOUNT_USER (ACCOUNT_ID, USER_ID, GEO_ID) VALUES (?,?,?) ";
return msg;
And on Dashdb component I have set the parameter as below:
msg.account_id,msg.user_id,msg.geo_id
The third geo_id is the issue, I have tried something like the code below:
if(msg.req.query.geo_id===null){msg.geo_id=null}
or
if(msg.req.query.geo_id===null){msg.geo_id="null"}
The error I got is the one below:
dashDB query node: Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0420N Invalid character found in a character string argument of the function "DECIMAL". SQLSTATE=22018
I really appreciate if someone could help me on it .
Thanks,
Eduardo Diogo Garcia
Is it possible that msg.req.query.geo_id is set to an empty string?
In that case neither if statement above would get executed, and you would be trying to insert an empty string into a DECIMAL column. Maybe try something like this:
if (! msg.req.query.geo_id || msg.req.query.geo_id == '') {
msg.geo_id = null;
}

XML Mapper issue in Mybatis

nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
this is the syntax
it working well while fetching the result in ORACLE SQL DEVELOPER
but while start my local server it gives error
please suggest what need to fix on this
SQL is good and working to get records directly from DB
select
rownum test,
os_alternate_label "altlabel",
em_customs_bar_code "label",
em_source_appl "source",
'H5' "altoutcome",
DECODE(OS_NL_DO_NOT_LOAD,1,'NL',
DECODE(OS_H5_ALT_DUP_HOLD,1,'H5',
DECODE(OS_BD_RTS_EC,1,'BD',
DECODE(OS_H2_EC_HOLD,1,'H2',
DECODE(OS_HD_NO_DISP_HOLD,1,'HD',
DECODE(OS_H3_CBP_HOLD,1,'H3',
DECODE(OS_H4_USPIS_HOLD,1,'H4',
DECODE(OS_UD_RTS_CUSTOMER,1,'UD',
DECODE(OS_NQ_EU_WAIT_TIME,1,'NQ',
DECODE(OS_H1_iPASS_HOLD,1,'H1',
DECODE(OS_DG_DANGER_HOLD,1,'DG',
DECODE(OS_CC_COMM_HOLD,1,'CC',
DECODE(OS_H6_CUS_DUP_HOLD,1,'H6',
DECODE(OS_RL_RELEASE,1,'RL','XX')))))))))))))) "customoutcome",
em_destination_country "destCo",
em_recipient_last_name "tolastName",
em_recipient_business "tobusinessname",
em_recipient_address "toaddress",
em_recipient_city "tocity",
em_recipient_state "toregionprov",
em_recipient_postcode "postcode",
to_char(em_date_time_received,'MM/DD/YY HH24:MI') "timeReceived"
FROM CUSTOMS.OUTCOME_STATUS_T,
CUSTOMS.ECM_MANIFEST_T
WHERE OS_CUSTOMS_BAR_CODE = EM_CUSTOMS_BAR_CODE
Use escape character I believe the '/' used to define date is causing problem
<![CDATA[
select
rownum test,
os_alternate_label "altlabel",
em_customs_bar_code "label",
em_source_appl "source",
'H5' "altoutcome",
DECODE(OS_NL_DO_NOT_LOAD,1,'NL',
DECODE(OS_H5_ALT_DUP_HOLD,1,'H5',
DECODE(OS_BD_RTS_EC,1,'BD',
DECODE(OS_H2_EC_HOLD,1,'H2',
DECODE(OS_HD_NO_DISP_HOLD,1,'HD',
DECODE(OS_H3_CBP_HOLD,1,'H3',
DECODE(OS_H4_USPIS_HOLD,1,'H4',
DECODE(OS_UD_RTS_CUSTOMER,1,'UD',
DECODE(OS_NQ_EU_WAIT_TIME,1,'NQ',
DECODE(OS_H1_iPASS_HOLD,1,'H1',
DECODE(OS_DG_DANGER_HOLD,1,'DG',
DECODE(OS_CC_COMM_HOLD,1,'CC',
DECODE(OS_H6_CUS_DUP_HOLD,1,'H6',
DECODE(OS_RL_RELEASE,1,'RL','XX')))))))))))))) "customoutcome",
em_destination_country "destCo",
em_recipient_last_name "tolastName",
em_recipient_business "tobusinessname",
em_recipient_address "toaddress",
em_recipient_city "tocity",
em_recipient_state "toregionprov",
em_recipient_postcode "postcode",
to_char(em_date_time_received,'MM/DD/YY HH24:MI') "timeReceived"
FROM CUSTOMS.OUTCOME_STATUS_T,
CUSTOMS.ECM_MANIFEST_T
WHERE OS_CUSTOMS_BAR_CODE = EM_CUSTOMS_BAR_CODE
]]>

Tridion Workflow Error on EDA_ITEMS_UPDATE Stored Procedure When Restarting WF Activities

I'm hitting an error whenever 2 or more instances of a workflow is restarted. We have suspended workflows during a network incident in our office(s). It was a script timeout that disrupted the process. I couldn't reproduce this timeout anymore so I attempted to restart the workflow activities to complete the process. However, when I restart more than 1 suspended activity, I get this error (the full log is farther below):
Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails.
The statement has been terminated.
Restarting activities and letting it finish one by one has no problem.
Full Event Log:
An error occurred while executing the Workflow script.
The Script Engine returned the following information:
SOURCE:
Line = 0
Column = 0
Number = -2147220673
Source = Component.Save
Description =
<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="8004033F" Category="4" Source="Kernel" Severity="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
<tcm:Line ErrorCode="8004033F" Cause="false" MessageID="16137"><![CDATA[Unable to save Component (tcm:5-32795).]]>
<tcm:Token>RESID_4574</tcm:Token>
<tcm:Token>RESID_4418</tcm:Token>
<tcm:Token>tcm:5-32795</tcm:Token>
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="true">CDATA[No data found. ETA_ITEMS, U Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails. The statement has been terminated.
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="false"><![CDATA[A database error occurred while executing Stored Procedure "EDA_ITEMS_UPDATE".]]>
<tcm:Token>EDA_ITEMS_UPDATE</tcm:Token>
</tcm:Line>
<tcm:Details>
<tcm:CallStack>
<tcm:Location>System.Data.SqlClient.SqlConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlInternalConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.Run(RunBehavior,SqlCommand,SqlDataReader,BulkCopySimpleResultSet,TdsParserStateObject)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader,RunBehavior,String)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior,RunBehavior,Boolean,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior,RunBehavior,Boolean,String,DbAsyncResult)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult,String,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.ExecuteNonQuery()</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.DatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Update(IdentifiableObjectData)</tcm:Location>
<tcm:Location>Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save()</tcm:Location>
<tcm:Location>Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.UpdateAndCheckIn(UserContext,String,Boolean,Boolean)</tcm:Location>
<tcm:Location>XMLState.Save</tcm:Location>
<tcm:Location>Component.Save</tcm:Location>
</tcm:CallStack>
</tcm:Details>
</tcm:Error>
HelpFile =
HelpContext = 1000440
caused by: Component.Save
and description:
<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="8004033F" Category="4" Source="Kernel" Severity="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
<tcm:Line ErrorCode="8004033F" Cause="false" MessageID="16137"><![CDATA[Unable to save Component (tcm:5-32795).]]>
<tcm:Token>RESID_4574</tcm:Token>
<tcm:Token>RESID_4418</tcm:Token>
<tcm:Token>tcm:5-32795</tcm:Token>
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="true">CDATA[No data found. ETA_ITEMS, U Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails. The statement has been terminated.
</tcm:Line>
<tcm:Line ErrorCode="8004033F" Cause="false"><![CDATA[A database error occurred while executing Stored Procedure "EDA_ITEMS_UPDATE".]]>
<tcm:Token>EDA_ITEMS_UPDATE</tcm:Token>
</tcm:Line>
<tcm:Details>
<tcm:CallStack>
<tcm:Location>System.Data.SqlClient.SqlConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlInternalConnection.OnError(SqlException,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(</tcm:Location>
<tcm:Location>System.Data.SqlClient.TdsParser.Run(RunBehavior,SqlCommand,SqlDataReader,BulkCopySimpleResultSet,TdsParserStateObject)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader,RunBehavior,String)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior,RunBehavior,Boolean,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior,RunBehavior,Boolean,String,DbAsyncResult)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult,String,Boolean)</tcm:Location>
<tcm:Location>System.Data.SqlClient.SqlCommand.ExecuteNonQuery()</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.DatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
<tcm:Location>Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Update(IdentifiableObjectData)</tcm:Location>
<tcm:Location>Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean)</tcm:Location>
<tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save()</tcm:Location>
<tcm:Location>Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.UpdateAndCheckIn(UserContext,String,Boolean,Boolean)</tcm:Location>
<tcm:Location>XMLState.Save</tcm:Location>
<tcm:Location>Component.Save</tcm:Location>
</tcm:CallStack>
</tcm:Details>
</tcm:Error>
Source:
LogScriptError
Workflow Info
The components are newly created by another application through BusinessConnector. It performs revision saves before finishing the activity. The objective of the WF is to
assign the necessary component links based on text values from the other system;
create a page;
and publish it to a target.
I know this could've been done better by other means but it is how it is right now, please bear with the implementation.
Model / Schema
Product
- modelName (text)
- categoryName (text)
- categoryCL (component link)
- statusName (text)
- statusCL (component link)
- blah1 (text)
- blah2 (text)
- blah3 (text)
- blah4 (text)
Automatic Activity Script:
' COMPONENT WORKFLOW for PRODUCT SCHEMA (START)
' Load common functions
ExecuteGlobal oTDSE.GetObject("/webdav/200%20Design/Building%20Blocks/Library/Design/Workflow/Common/Workflow%20Functions.tbbs", 1).Content
' Initialize
Set objComp = CurrentWorkItem.GetItem()
Set oContentPub = objComp.Publication
Set oWebsitePub = oTDSE.GetObject(GetStagingLangPub("EN", "website1"), 1)
modelName = objComp.Fields.Item("modelName").Value.Item(1)
' Search and Assign component links based on some text fields from BC client
Set compListRowFilter = oTDSE.CreateListRowFilter()
Call compListRowFilter.SetCondition("ShowNewItems", TRUE)
Call compListRowFilter.SetCondition("ItemType", 16)
' Assign the first component link (categoryCL)
categoryName = objComp.Fields.Item("categoryName").Value.Item(1)
Set categoryComp = GetObjectFromFolder(categoryName, oTDSE.GetObject(categoryFolderWebDav, 1), compListRowFilter)
If Not categoryComp is Nothing Then
objComp.Fields.Item("categoryCL").Value.RemoveAll
objComp.Fields.Item("categoryCL").Value.Add(categoryComp)
Call objComp.Save(True)
Else
Call SendNoObjectEmail("Category", categoryName, "categoryCL", GetEmailsFromGroup(oContentPub, categoryOwner), "")
End if
' Assign the second component link (statusCL)
statusName = objComp.Fields.Item("statusName").Value.Item(1)
Set statusComp = GetObjectFromFolder(statusName, oTDSE.GetObject(statusFolderWebDav, 1), compListRowFilter)
If Not statusComp is Nothing Then
objComp.Fields.Item("statusCL").Value.RemoveAll
objComp.Fields.Item("statusCL").Value.Add(statusComp)
Call objComp.Save(True)
Else
Call SendNoObjectEmail("Status", statusName, "statusCL", GetEmailsFromGroup(oContentPub, statusOwner), "")
End if
' Create a page with the component in WF
Set oPage = CreateDefaultPage(modelName, oWebSitePub, SaveToFolderWebDav, PageTemplateWebDav)
Call oPage.ComponentPresentations.Add(oWebSitePub, oTDSE.GetObject(ComponentTemplateWebDav, 1))
oPage.Save(True)
' Publish the page
....
' Send email
....
' Finish the Activity
Call CurrentWorkItem.ActivityInstance.FinishActivity("someMsg")
' COMPONENT WORKFLOW for PRODUCT SCHEMA (END)
I haven't zoomed in to where exactly it happens but I would assume it is either the categoryCL or statusCL's objComp.Save(True) line.
I notice that you are calling Call objComp.Save(True) - The "True" parameter forces a "CheckIn", as it means "Done Editing".
It looks like this can occur twice (i.e. If there is a statusCL and a categoryCL) whichmay be causing the problem. I would try changing the behavior so that you only the call Save() method at the end if a change has been made, and not saving it twice.
From what I see the problem is that you are trying to assign nulls as component links. Are you sure that you are not trying to link these 2 components one to another? It might be that the link you are trying to create is to new component in workflow (it has no checked-in version yet), hence you can't create link to it. Try adding some logging to your script, so we could see where exactly does it fail and what are the parameters.
And I agree with Frank that this exception is worth a defect report.