Skip to content

Instantly share code, notes, and snippets.

@gispd
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gispd/d8584a4dc10682ae19c7 to your computer and use it in GitHub Desktop.
Save gispd/d8584a4dc10682ae19c7 to your computer and use it in GitHub Desktop.
A function to get a Geodatabase path from the feature class or table
def get_geodatabase_path(input_table):
'''Return the Geodatabase path from the input table or feature class.
:param input_table: path to the input table or feature class
'''
workspace = os.path.dirname(input_table)
if [any(ext) for ext in ('.gdb', '.mdb', '.sde') if ext in os.path.splitext(workspace)]:
return workspace
else:
return os.path.dirname(workspace)
@gispd
Copy link
Author

gispd commented Dec 23, 2014

Fixed typo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment