Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@woodphil
Created January 5, 2016 23:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woodphil/32bc2c7aa37282664ee9 to your computer and use it in GitHub Desktop.
Save woodphil/32bc2c7aa37282664ee9 to your computer and use it in GitHub Desktop.
Python sqlite absolute path to database
package_dir = os.path.abspath(os.path.dirname(__file__))
db_dir = os.path.join(package_dir, 'nd_slack.db')
# NEED 4 /'s to specify absolute for sqlalchemy!
# ex: sqlite:////asdfaijegoij/aerga.db
# NEED 3 /'s for relative paths
# path has a / at the beginning so we have 3 here
SQLITE_DB = ''.join(['sqlite:///', db_dir])
@jinnyMcKindy
Copy link

Great, thanks

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