You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
soql="""SELECT Id,UserId,LoginTime,LoginType,SourceIp,LoginUrl,AuthenticationServiceId,LoginGeoId,TlsProtocol,OptionsIsGet,OptionsIsPost,Browser,Platform,Status,Application,ClientVersion,ApiType,ApiVersion,CountryIso FROM LoginHistory WHERE LoginTime >= 2019-12-29T00:00:00+00:00 AND LoginTime < 2019-12-30T00:00:00+00:00"""df= (
spark.read.format("com.springml.spark.salesforce")
.option("username", "XXX")
.option("password", "XXX")
.option("login", "https://test.salesforce.com")
.option("soql", soql)
.option("version", "47.0")
.load()
)
Error that I got:
An error occurred while calling o38.load.
: java.lang.Exception: Accessing https://ninjavan--dev.my.salesforce.com/services/data/v47.0/query?q=SELECT%20Id,UserId,LoginTime,LoginType,SourceIp,LoginUrl,AuthenticationServiceId,LoginGeoId,TlsProtocol,OptionsIsGet,OptionsIsPost,Browser,Platform,Status,Application,ClientVersion,ApiType,ApiVersion,CountryIso%20FROM%20LoginHistory%20WHERE%20LoginTime%20%3E=%202019-12-29T00:00:00+00:00%20AND%20LoginTime%20%3C%202019-12-30T00:00:00+00:00 failed. Status 400. Reason Bad Request
Error from server [{"message":"\nLoginTime >= 2019-12-29T00:00:00 00:00 AND LoginTime < 2019-12-30T00:00:00\n ^\nERROR at Row:1:Column:265\nline 1:265 no viable alternative at character ' '","errorCode":"MALFORMED_QUERY"}]
at com.springml.salesforce.wave.util.HTTPHelper.execute(HTTPHelper.java:118)
at com.springml.salesforce.wave.util.HTTPHelper.get(HTTPHelper.java:91)
at com.springml.salesforce.wave.util.HTTPHelper.get(HTTPHelper.java:95)
at com.springml.salesforce.wave.impl.ForceAPIImpl.query(ForceAPIImpl.java:138)
at com.springml.salesforce.wave.impl.ForceAPIImpl.query(ForceAPIImpl.java:37)
at com.springml.spark.salesforce.DatasetRelation.querySF(DatasetRelation.scala:105)
at com.springml.spark.salesforce.DatasetRelation.read(DatasetRelation.scala:47)
at com.springml.spark.salesforce.DatasetRelation.<init>(DatasetRelation.scala:39)
at com.springml.spark.salesforce.DefaultSource.createRelation(DefaultSource.scala:99)
at com.springml.spark.salesforce.DefaultSource.createRelation(DefaultSource.scala:50)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:318)
at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:223)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:211)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
at py4j.Gateway.invoke(Gateway.java:282)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.lang.Thread.run(Thread.java:748)
As you can see, Salesforce interprets the + sign as a whitespace, hence LoginTime >= 2019-12-29T00:00:00 00:00 in the error response. I think perhaps we should encode + sign to %2B?
I tried encoding the query on my own as a workaround, but in the end result, it became doubly-encoded.
Also tried passing only the date, LoginTime >= 2019-12-29. Didn't work out.
py4j.protocol.Py4JJavaError: An error occurred while calling o49.load.
: java.lang.Exception: Accessing https://ninjavan--dev.my.salesforce.com/services/data/v47.0/query?q=SELECT%20Id,IsDeleted,CreatedDate,LastModifiedDate,ActivityDate,OwnerId,AccountId,CreatedById,TaskSubtype,CompletedDateTime%20FROM%20Task%20WHERE%20LastModifiedDate%20%3E=%202020-01-09%20AND%20LastModifiedDate%20%3C%202020-01-10 failed. Status 400. Reason Bad Request
Error from server [{"message":"\nCompletedDateTime FROM Task WHERE LastModifiedDate >= 2020-01-09 AND\n ^\nERROR at Row:1:Column:139\nvalue of filter criterion for field 'LastModifiedDate' must be of type dateTime and should not be enclosed in quotes","errorCode":"INVALID_FIELD"}]
The text was updated successfully, but these errors were encountered:
teddyhartanto
changed the title
Plus sign isn't encoded and Salesforce Force API interpret it as a whitespace
Plus sign isn't URL-encoded and Salesforce Force API interpret it as a whitespace
Jan 13, 2020
As per the title says.
My code:
Error that I got:
As you can see,
Salesforce
interprets the+
sign as a whitespace, henceLoginTime >= 2019-12-29T00:00:00 00:00
in the error response. I think perhaps we should encode+
sign to%2B
?I tried encoding the query on my own as a workaround, but in the end result, it became doubly-encoded.
Also tried passing only the date,
LoginTime >= 2019-12-29
. Didn't work out.The text was updated successfully, but these errors were encountered: