[GIS] Creating temporary in-memory geodatabase using ArcPy

arcmaparcpyesri-geodatabasememory

I have been using in-memory workspace for creating temporary features, but I was wondering if we could create a temporary in-memory geodatabase (using ArcPy) and then use it for importing other in-memory features?

Best Answer

As @PolyGeo said, you won't be able to use the in_memory workspace for Geodatabases.

If you want a "temporary" geodatabase that is saved on disk, you can use the Scratch GDB.

#Set the path to GDB, if desired. 
#Consult help if you don't want to set this and want to know its location.
arcpy.env.scratchWorkspace = r"D:\GIS\data"

#Path to newly created gdb.
gdb = arcpy.env.scratchGDB

print gdb
>>> "D:\GIS\data\scratch.gdb"