Skip to content
New issue

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

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

Already on GitHub? # to your account

arc.select() drops relationship field. #36

Closed
mschmidty opened this issue Jan 10, 2020 · 8 comments
Closed

arc.select() drops relationship field. #36

mschmidty opened this issue Jan 10, 2020 · 8 comments

Comments

@mschmidty
Copy link

mschmidty commented Jan 10, 2020

Not sure why, but when you use arc.select() on dataset_type:Table it drops the relationship field.

test<-arc.open('//some/path/CO_EDT_User.sde/dbSCHMEA.Nest_Productivity')
test

Output:

> test
dataset_type    : Table
path            : //some/path/CO_EDT_User.sde/dbSCHMEA.Nest_Productivity
fields          : OBJECTID, ADM_UNIT_CD, NEST_ID, SURVEY_TYPE, SURVEY_DATE, SPECIES, ACTIVITY, 
fields          : NEST_CONDITION, NUM_ADULTS, NUM_YOUNG, ACT_OBS, NEST_STATUS, SRVY_COMMENT, 
fields          : NEST_GUID, GlobalID, created_user, created_date, last_edited_user, 
fields          : last_edited_date

NEST_GUID is in the field list.

But then:

> test%>%
+   arc.select()%>%
+   names()
 [1] "OBJECTID"         "ADM_UNIT_CD"      "NEST_ID"          "SURVEY_TYPE"     
 [5] "SURVEY_DATE"      "SPECIES"          "ACTIVITY"         "NEST_CONDITION"  
 [9] "NUM_ADULTS"       "NUM_YOUNG"        "ACT_OBS"          "NEST_STATUS"     
[13] "SRVY_COMMENT"     "GlobalID"         "created_user"     "created_date"    
[17] "last_edited_user" "last_edited_date"

NEST_GUID Disappears???? Is this the intended functionality?

@dpavlushko
Copy link
Contributor

Looks good to me. Line 1 column 3 - "NEST_ID"

@mschmidty
Copy link
Author

mschmidty commented Jan 10, 2020

Looks good to me. Line 1 column 3 - "NEST_ID"

Sorry. That was a typo. The field that I'm looking for is NEST_GUID. NEST_GUID is the field that is related to a feature class. NEST_ID is the name of the nest.

@dpavlushko
Copy link
Contributor

By default arc.select() strip some database types unsupported in R.
To verify column type use this command:

test@fields$NEST_GUID

I guess , NEST_GUID column is GUID type? if so, you can explicitly include this field into a search and it will be converted to a string.

test<-arc.open('//some/path/CO_EDT_User.sde/dbSCHMEA.Nest_Productivity')

d<-arc.select(test, c('*', 'NEST_GUID')
# or
d<-arc.select(test, names(test@fields))

@mschmidty
Copy link
Author

mschmidty commented Jan 13, 2020

Yes, NEST_GUID is a GUID field.

> test@fields$NEST_GUID
[1] "GUID"

I tried both of your solutions and both still strip the field.

> d<-arc.select(test, c('*', 'NEST_GUID'))
> names(d)
 [1] "OBJECTID"         "ADM_UNIT_CD"      "NEST_ID"          "SURVEY_TYPE"     
 [5] "SURVEY_DATE"      "SPECIES"          "ACTIVITY"         "NEST_CONDITION"  
 [9] "NUM_ADULTS"       "NUM_YOUNG"        "ACT_OBS"          "NEST_STATUS"     
[13] "SRVY_COMMENT"     "GlobalID"         "created_user"     "created_date"    
[17] "last_edited_user" "last_edited_date"
# and
> d1<- arc.select(test, names(test@fields))
> names(d1)
 [1] "OBJECTID"         "ADM_UNIT_CD"      "NEST_ID"          "SURVEY_TYPE"     
 [5] "SURVEY_DATE"      "SPECIES"          "ACTIVITY"         "NEST_CONDITION"  
 [9] "NUM_ADULTS"       "NUM_YOUNG"        "ACT_OBS"          "NEST_STATUS"     
[13] "SRVY_COMMENT"     "GlobalID"         "created_user"     "created_date"    
[17] "last_edited_user" "last_edited_date"

It's weird because GlobalID contains an ID string similar to NEST_GUID and it is converted to a Character just fine. But for whatever reason the NEST_GUID, GUID field is removed even though it contains similar character strings.

Testing further: trying to just select the GlobalID works, but selecting NEST_GUID returns an error:

d2<-arc.select(test, 'GlobalID') #works 
d3<-arc.select(test, 'NEST_GUID') #error
Error in .call_proxy("table.select", object, fields, as.pairlist(args)) : 
  COM error

@dpavlushko
Copy link
Contributor

You are right. GUID field always skipped. I'm going to fix it in the next build.

@scdub
Copy link

scdub commented Jan 13, 2020

@dpavlushko Great! I think always including them as a string seems right, that's the datatype that packages like UUID use when working with UUIDs in R.

@mschmidty
Copy link
Author

@dpavlushko Awesome. Much appreciated.

@scdub
Copy link

scdub commented Jan 31, 2020

@mschmidty This should be fixed in the v239 release -- if you still see this issue, let us know and we can reopen this. Thanks for the report!

@scdub scdub closed this as completed Jan 31, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants