Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Parsing of Relationship Queries #38

Closed
StevenMMortimer opened this issue Sep 14, 2019 · 0 comments
Closed

Fix Parsing of Relationship Queries #38

StevenMMortimer opened this issue Sep 14, 2019 · 0 comments
Assignees
Labels
bug Unintended behavior that should be corrected
Milestone

Comments

@StevenMMortimer
Copy link
Owner

StevenMMortimer commented Sep 14, 2019

Currently, salesforcer is providing weird results for relationship queries, including some unexplained "hanging" behavior (noted in #19 and #35). We should take a closer look into identifying and parsing these types of queries. Below are some odd examples currently happening with v0.1.3. Only Child-to-Parent queries made with the REST API appear to be working as expected (flattening).

Child-to-Parent Queries

REST API

sf_query("SELECT Name, Account.Id, Account.Name FROM Contact")
#> # A tibble: 3 x 3
#>   Name         Account.Id         Account.Name                   
#>   <chr>        <chr>              <chr>                          
#> 1 Ashley James 0016A0000035mJCQAY United Oil & Gas, UK           
#> 2 Avi Green    0016A0000035mJ9QAI United Oil & Gas Corp.         
#> 3 Babara Levy  0016A0000035mJAQAY Express Logistics and Transport

SOAP API

sf_query("SELECT Name, Account.Id, Account.Name FROM Contact", api_type="SOAP")
#> # A tibble: 3 x 3
#>   Id    Name         Account         
#>   <lgl> <chr>        <list>          
#> 1 NA    Ashley James <named list [4]>
#> 2 NA    Avi Green    <named list [4]>
#> 3 NA    Babara Levy  <named list [4]>

Parent-to-Child Queries

REST API

sf_query("SELECT Name, (SELECT LastName FROM Contacts) FROM Account")
#> # A tibble: 9 x 4
#>   Name                     Contacts.totalSi… Contacts.done Contacts.records
#>   <chr>                                <int> <lgl>         <list>          
#> 1 GenePoint                                1 TRUE          <named list [3]>
#> 2 United Oil & Gas, UK                     1 TRUE          <named list [3]>
#> 3 United Oil & Gas, Singa…                 2 TRUE          <named list [3]>
#> 4 Edge Communications                      2 TRUE          <named list [3]>
#> 5 Burlington Textiles Cor…                 1 TRUE          <named list [3]>
#> 6 Grand Hotels & Resorts …                 2 TRUE          <named list [3]>
#> 7 Express Logistics and T…                 2 TRUE          <named list [3]>
#> 8 University of Arizona                    1 TRUE          <named list [3]>
#> 9 United Oil & Gas Corp.                   3 TRUE          <named list [3]>

SOAP API

sf_query("SELECT Name, (SELECT LastName FROM Contacts) FROM Account", api_type="SOAP")
#> # A tibble: 24 x 4
#>    Id    Name                        Contacts         LastName
#>    <lgl> <chr>                       <list>           <chr>   
#>  1 NA    GenePoint                   <named list [4]> <NA>    
#>  2 NA    <NA>                        <NULL>           Frank   
#>  3 NA    United Oil & Gas, UK        <named list [4]> <NA>    
#>  4 NA    <NA>                        <NULL>           James   
#>  5 NA    United Oil & Gas, Singapore <named list [5]> <NA>    
#>  6 NA    <NA>                        <NULL>           D'Cruz  
#>  7 NA    <NA>                        <NULL>           Ripley  
#>  8 NA    Edge Communications         <named list [5]> <NA>    
#>  9 NA    <NA>                        <NULL>           Forbes  
#> 10 NA    <NA>                        <NULL>           Gonzalez
#> # … with 14 more rows

In both examples above there is a wonky way of flattening the nested results which either returns unnecessary attributes data (REST API) or mismatches the attributes with the child data results (SOAP API). This needs to be fixed.

@StevenMMortimer StevenMMortimer changed the title Add Nested Parent-to-Child Relationship Queries Fix Parsing of Relationship Queries Sep 14, 2019
@StevenMMortimer StevenMMortimer self-assigned this Sep 14, 2019
@StevenMMortimer StevenMMortimer added the bug Unintended behavior that should be corrected label Sep 14, 2019
@StevenMMortimer StevenMMortimer added this to the 0.1.4 milestone Sep 14, 2019
@StevenMMortimer StevenMMortimer modified the milestones: 0.1.4, 0.1.5 Dec 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended behavior that should be corrected
Projects
None yet
Development

No branches or pull requests

1 participant