SkyVia Connect and guid

  • 33Views
  • Last Post 08 February 2019
0
votes
Justin Ainsworth posted this 05 February 2019

I'm new to SkyVIA, and i am experimenting with publishing an Azure SQL database using a connect endpoint.

I have a very simple table, named Menu that has 3 fields.  

  ID (uniqueidentifier)

  Name (varchar(255))

  Active (bit)

I have populated the database with a single record:

ID: 70fcabd9-41e6-4b54-9720-8f9ca38fb604

Title: Company Menu

Active: 1

 

when i do a GET /xxxxxxxx/Menus it returns the single record.  Great.

what i am noticing is, when querying for a single record, using the following syntax it is failing:  

GET /xxxxxxxx/Menus(ID=guid'70fcabd9-41e6-4b54-9720-8f9ca38fb604')?$format=json.  From looking at the logs, i can see it is generating the following query: SELECT t.ID, t.Title, t.Active FROM dbo.Menu AS t WITH (NOLOCK)  WHERE (t.ID = 'ID=guid''70fcabd9-41e6-4b54-9720-8f9ca38fb604'''

If i remove the column name, it still fails.  If i remove both the column name and type qualifier it still fails.  However, if i also remove the single quotes around the guid string, it works:  GET /xxxxxxxx/Menus(70fcabd9-41e6-4b54-9720-8f9ca38fb604)?$format=json

 

is this the expected behavior?  

When i return an atom result, and look at a link reference, it returns the following: https://connect.skyvia.com/xxxxxxxx/Menus(guid'70fcabd9-41e6-4b54-9720-8f9ca38fb604').  That link does not work, because it doesn't like the single quotes or type qualifier.

 

thanks,

Order By: Standard | Newest | Votes
0
votes
Mariia Zaharova posted this 05 February 2019

Hi Justin!

Please try this format:

GET /xxxxxxxx/Menus?$filter=ID eq 70fcabd9-41e6-4b54-9720-8f9ca38fb604

 

Looking forward to your reply.

 

Best regards,

Mariia

0
votes
Justin Ainsworth posted this 07 February 2019

I was just able to try your suggestion, and it was failing, with the error being "Syntax error at position 14 in 'ID eq 70fcabd9-41e6-4b54-9720-8f9ca38fb604'."  Position 14 is the first '-' in the guid.  I tried using single quotes on the quid, and that failed also.

However, i was able to do: GET /xxxxxxxx/Menus?$filter=Title eq 'Company Menu'

which does work.  Still feels like some sort of issue with the handling of guid's/uniqueidentifier.

0
votes
Mariia Zaharova posted this 08 February 2019

Hi Justin!

 

It seems you are using oData v1-3 for your endpoint. Please change oData version to v4 and try again:

GET /xxxxxxxx/Menus?$filter=ID eq 70fcabd9-41e6-4b54-9720-8f9ca38fb604

 

We are able to return single record using this syntax.

 

Looking forward to your reply with the results.

 

Best regards,

Mariia

Close