Define data type for enterprise gdb feature class fields using python script and a csv template

396
0
05-16-2022 09:03 AM
CaraWiebalk
New Contributor II

Is there a way to create a feature class from a table and limit the size of fields/define what field type they should be? I have a script that will use a csv template made from the original table to create a feature class. i would like to keep using this method (or a similar one) as the fields may not always be the same across all the tables I want to run this script on.

 

Brief outline of what the script does:

  • export the SQL server table to csv
  • create an enterprise gdb
  • use the csv as a template to create a feature class
  • append the data from the csv to the feature class

However, this makes all text fields be nvarchar(MAX), in the original table they are nvarchar(50). I also have a datetime field that was datetime and is now also nvarchar(MAX). Finally, the lat/long fields were decimal(24,7) but are now numeric(38,8).

 

 

0 Kudos
0 Replies