I'm trying to read data from snowflake database table into databricks. Below is my code:
options = {
"sfUrl": "xxxxxx.snowflakecomputing.com",
"sfUser": "xxxxxxx",
"sfPassword": "xxxx",
"sfDatabase": "xxxxxxx",
"sfSchema": "xxxxxxx",
"sfWarehouse": "xxxxxxxxx",
"sfRole": "xxxxxxxx"
}
df = spark.read.format('snowflake').option(**options).option('query', 'select * from mytable').load()
I got the error like below:
TypeError: option() got an unexpected keyword argument 'sfUrl'
I followed the instruction onthis link. I do not understand why it failed. Does anyone know what went wrong?
Change sfUrl to sfURL and then test this operation.
Related
I'm using IBM Watson Discovery. I'm using python to craete a discovery query. I want to add passages.fields query parameter to get the passage out gf html instead of text. I've tried the below code:
import json
from ibm_watson import DiscoveryV2
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
authenticator = IAMAuthenticator('xxxxx')
discovery = DiscoveryV2(
version='2020-08-30',
authenticator=authenticator
)
discovery.set_default_headers({'x-watson-learning-opt-out': "true"})
response = discovery.query(
project_id='xxxxx',
natural_language_query='zero',
passages.fields: "html"
).get_result()
However, I'm getting the below error:
File "<ipython-input-92-730c62f58ce1>", line 18
passages.fields: "html"
^
SyntaxError: invalid syntax
Any help please?
Thanks,
I am receiving this error when trying to initialize a token contract on kadena.
I am using free.mykeyset name in the define and enforce
keysetname in read
Calling transaction , tried using the signer "keysetname" as well as the full non k public address. I am able to deploy but cannot initialize, not sure why it seems to be a database error, nor can I find any info on "pactinternalerror"'s.
Any advice would be appreciated!
Error from (api.testnet.chainweb.com): : Failure: Database exception: {"tag":"PactInternalError","contents":"callDb (doReadRow): user error (Database error: ErrorError)"}
You need add "create-table" function below your module and run it.
Example:
...
my module code
...
(if (read-msg "upgrade")
["upgrade"]
[
(create-table my-table)
]
)
I am facing the below issue with Azure Data Factory using Logic App.
I am using the Azure Data Factory pipeline for migration and Logic App for sending "Success & Failure" notification to the technical team.
Now success is working fine as the message is hardcoded, but failure is not as the Logic App web activity is not able to parse data factory pipeline error.
Here is the input that is going to Logic App web activity
Input
{
"url": "https://xxxxxxxxxxxxxxxxx",
"method": "POST",
"headers": {},
"body": "{\n \"title\": \"PIPELINE RUN FAILED\",\n \"message\":\"Operation on target Migration Validation failed: Execution fail against sql server. Sql error number: 50000. Error Message: The DELETE statement conflicted with the REFERENCE constraint \"FK_cmclientapprovedproducts_cmlinkclientchannel\". The conflict occurred in database \"Core7\", table \"dbo.cmClientApprovedProducts\", column 'linkclientchannelid'.\",\n \"color\": \"Red\",\n \"dataFactoryName\": \"LFC-TO-MCP-ADF\",\n \"pipelineName\": \"LFC TO MCP MIGRATION\",\n \"pipelineRunId\": \"f4f84365-58f0-4da1-aa00-64c3a4daa9e1\",\n \"time\": \"2020-07-31T22:44:01.6477435Z\"\n}"
}
Here is the error logic app is throwing
failures
{
"errorCode": "2108",
"message": "{\"error\":{\"code\":\"InvalidRequestContent\",\"message\":\"The request content is not valid and could not be deserialized: 'After parsing a value an unexpected character was encountered: F. Path 'message', line 3, position 202.'.\"}}",
"failureType": "UserError",
"target": "Send Failed Notification",
"details": []
}
I have tried various options, like set variable and convert by using various existing methods (string, json, replace etc), but no luck
e.g #string(activity('LOS migration').Error.Message)
Struggling almost all day this...please suggest if anyone faced a similar issue...
Below is the data flow activity
now it is working...
Pasting body content into the body text field box WITHOUT clicking on 'Add Dynamic Content' in web activity calling Logic App.
For the failure case, pass the error output use #{activity('LOS migration').error.message.
For sending email, it doesn't know if it's going to send a failure or success email. We have to adapt the body so the activity can use parameters, which we'll define later:
{
"DataFactoryName": "#{pipeline().DataFactory}",
"PipelineName": "#{pipeline().Pipeline}",
"Subject": "#{pipeline().parameters.Subject}",
"ErrorMessage": "#{pipeline().parameters.ErrorMessage}",
"EmailTo": "#pipeline().parameters.EmailTo"
}
We can reference this variables in the body by using the following format: #pipeline().parameters.parametername. For more details, you could refer to this article.
If you want to use the direct error message of the data factory activity as an input to the logic app email expression, you could try.
"ErrorMessage": "#{string(replace(activity('activity_name').Error.Message, '"',''''))}"
Replace 'activity_name' with your failing activity name.
I tried to use "models.CheckConstraint" to validate birthday field like that:
class CustomUser(AbstractUser):
birthday = models.DateField(null=True)
class Meta:
constraints = [
models.CheckConstraint(
check=Q(birthday__lt=date.today()),
name='check_birthday')
]
When "birthday" < date.today(), it's work fine but when I type some value of "birthday" > date.today(), it shows me an error:
IntegrityError at /api/user/
CHECK constraint failed: check_birthday
Request Method: POST
Django Version: 3.0.7
Python Version: 3.7.3
I followed the docs: https://docs.djangoproject.com/en/3.0/ref/models/options/#constraints
Please tell me why? Thank you.
IntegrityError is an error thrown by database handler, not by view, serializer, form or whatever. Therefore your view does not know what to do with it and passes it as server error.
I am using the Gmail API to create a label, using URL https://www.googleapis.com/gmail/v1/users/me/labels. Works perfectly for me. However several customers are reporting this fails with http error 400, with the error:
"domain": "global", "reason": "parseError", "message": "Parse Error"
The json that is input to the call is very simple, example:
{"name":"Secretarial Misc."}
Any idea what the problem could be? Why would the exact same json work for me but not somebody else?
The data you show should, according to the specification, not work for anyone. It's peculiar that is works for you! Try this:
POST https://www.googleapis.com/gmail/v1/users/me/labels?access_token={YOUR_API_KEY}
{
"labelListVisibility": "labelShow",
"messageListVisibility": "show",
"name": "Secretarial Misc."
}