Requirements for OID Field in SqLite Database

1119
4
Jump to solution
11-19-2020 12:43 AM
Ulrich_Egger
New Contributor

I would like to develop an ArcGIS Pro AddOn that uses the same SqLite Database as another product of my company. For the tables in the Database, the OBJECTID / OID field is missing.

What are the requirements from the perspective of the SQLite Database to fullfill the ArcGIS Pro requirements ? How can I create such a field in SqLite ?

 

0 Kudos
1 Solution

Accepted Solutions
UlrichEgger
New Contributor III

I think I found what I need by opening a feature Class created (or in my case copied) by ArcGIS Pro and then opening the file in DB Browser for sqlite. There, it is possible to see the create statement for the table.

 

CREATE TABLE [Schacht] (OBJECTID integer primary key autoincrement not null, ....

So the OBJECTID must be

integer

primary key

autoincrement

not null

 

View solution in original post

0 Kudos
4 Replies
by Anonymous User
Not applicable

You can look here:

https://pro.arcgis.com/en/pro-app/help/data/databases/work-with-sqlite-databases-in-arcgis-pro.htm#:....

and here:

https://www.esri.com/arcgis-blog/products/product/data-management/how-to-use-ogc-geopackages-in-arcg...

For some input.  It appears that not all versions supported tables to start out with, so make sure you're using a release that supports it.

 

0 Kudos
Ulrich_Egger
New Contributor

I don't find there what I am looking for. If I create a column in a table by 

ALTER TABLE table_name
ADD new_column_name column_definition;

where new_column_name = 'OBJECTID', what do I need to take as column_definition in order to get an OBJECTID column that will be working with ArcGIS Pro ? 

 

0 Kudos
by Anonymous User
Not applicable

That will not work.  You have to create a geodatabase first, which will in essence create stored procedures and functions that aid in creating feature classes and tables in that database.  The instructions on how to create a geodatabase are in the links in my reply above, specifically:  Create SQLite Database (Data Management)—ArcGIS Pro | Documentation 

Once you follow these instructions you should then be able to create a feature class (point/lines/polygons) and/or tables by using the right click on the database.   Once created, you can also add the database to your project to make access easier.

 
 

Screen1.png

 

0 Kudos
UlrichEgger
New Contributor III

I think I found what I need by opening a feature Class created (or in my case copied) by ArcGIS Pro and then opening the file in DB Browser for sqlite. There, it is possible to see the create statement for the table.

 

CREATE TABLE [Schacht] (OBJECTID integer primary key autoincrement not null, ....

So the OBJECTID must be

integer

primary key

autoincrement

not null

 

0 Kudos