Select to view content in your preferred language

Adding records to Feature Class from R

133
0
05-26-2025 07:59 PM
EduardoDC
Emerging Contributor

Hello everyone, I´ve working in a script that its supossed to adds rows into a feature class stored in a Enterprise Geodatabase. Code works if I create the table using the mssms and setting OBJECTID as identity, but if the table is created trough ArcGIS Pro the OBJECTID field is not setted as identity and OBJECTIDs are not created while I'm inserting records fom my script.

The error message is: Cannot insert the value NULL into column 'OBJECTID', table 'arcgis.do_pers.Calls'; column does not allow nulls.
INSERT fails.

In R I use:

query <- glue_sql("
INSERT INTO Calls ( field1, field2, etc.) VALUES (field1$value, field2$value, etc), .con = conexiondata)

dbExecute(con, query)

Using odbc and glue librarys.

I know that the trouble is solved adding a value into OBJECTID field but it is not a recommendable workflow.

So I want ot know if someone has faced a similar problem. The purpose of this is to create a realtime data example. Perhaps this trouble could be solved using the r-bridge but I couldnt find an "add_rows workflow".

Tags (3)
0 Kudos
0 Replies