How can I import a geodatabase into a python script as a parameter?

07-29-2016 04:07 PM
New Contributor

I have the script to list all feature datasets, feature classes and field properties within a geodatabase, but I would like to make the input gdb a parameter(argument). I am more familiar with model builder, but python seems more favorable of a code for this circumstance. I would like the output to simply be through IDLE, I just want to make the gdb a variable.

new to python script,but working at it, any advice is appreciated!

0 Kudos
2 Replies
MVP Esteemed Contributor

it is a workspace ListWorkspaces—Help | ArcGIS for Desktop

So you can use it to list file geodatabases within a folder for instance, just select the limiter that you wish to show

MVP Esteemed Contributor

If you create you own script tool and set it up to accept parameters, you should be able to load the custom Python module/tool and run it at the command prompt.

What is a script tool?—Help | ArcGIS for Desktop

Understanding script tool parameters—Help | ArcGIS for Desktop

Executing tools in the Python window—Help | ArcGIS for Desktop

A quick tour of creating custom tools—Help | ArcGIS for Desktop

A quick tour of creating custom tools—Help | ArcGIS for Desktop

Running custom (model or script) tools in the background—Help | ArcGIS for Desktop

this is is a list of some of the topics that may help you.  Most have Python script samples.  If you are looking for some more specific suggestions on how to get it to work with your script, try, Posting Code blocks in Esri GeoNet​ for additional feedback.