3

I am trying to export 5 feature classes from Geodatabase to SQLite database using arcpy script. I have ESRI script that creates empty SQLite Database all I need now is just to update the script to make it copy my features classes.

# -*- #################
"""
Tool name: Create SQLite Database
Source: CreateSQLiteDatabase.py
Author: ESRI

Create a SQLite database of the selected flavor: ST_Geometry, SpatiaLite, GeoPackage.
"""

import arcpy
import os
import sys

def create_sqlite_database(in_sqlite_location, geometry_storage):
    """ create a new SQLite database. """

    # Strip the file extension from the location.
    in_sqlite_database = os.path.splitext(in_sqlite_location)[0] 

    # Verify that the target folder exists.
    if not(arcpy.Exists(os.path.dirname(in_sqlite_database))):
        arcpy.AddIDMessage("ERROR", 695)
        sys.exit (1)

    if arcpy.Exists(in_sqlite_location):
        if arcpy.env.overwriteOutput == False:
            arcpy.AddIDMessage("ERROR", 159, in_sqlite_location)
            if __name__ == '__main__':
                print (u'ERROR ' + arcpy.GetIDMessage(159))
                sys.exit(1)
            else:
                raise arcpy.ExecuteError (arcpy.GetIDMessage(159))

    # Create the SQLite dataset
    arcpy.gp.CreateSQLiteDB(in_sqlite_location ,geometry_storage)


if __name__ == "__main__":
    # Get the parameters from the script tool
    create_sqlite_database(arcpy.GetParameterAsText(0),
                   arcpy.GetParameterAsText(1)) 

The problem is that I cannot use feature class to feature class because in basic licence I cannot copy feature from geodatabase to sqlite database.

I am using ArcGIS Pro 1.3 Basic.

closed as off-topic by PolyGeo Feb 16 '17 at 4:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please edit your question to include the values you entered in create_sqlite_database(arcpy.GetParameterAsText(0), arcpy.GetParameterAsText(1)). Also include the code snippet you've tried for exporting from geodatabase to sqlite. – Midavalo Feb 11 '17 at 17:41
  • Have you tried using arcpy.Copy_management()? – Midavalo Feb 11 '17 at 18:28
  • Well when I use feature class to feature class with advance licence it allow me to export sqlite dB but when I try it on basic licence it is locked. That's why I am trying now to create script which will do the same thing – Losbaltica Feb 11 '17 at 19:06
  • My values are just a normal feature class which I would like to export to sqlite dB. I would be really helpful if I could somehow put as many feature class I would like , similar to tool like merge when you can add many shp at the same time – Losbaltica Feb 11 '17 at 19:11
  • 2
    please edit your question to include your input parameters, and the code you've tested to perform the copy/export – Midavalo Feb 11 '17 at 19:13