Maintainer: Colin Stephen
NOTE: This environment is configured for Windows only. If you use Linux / OSX then come and speak to Colin during support hours or during a class for guidance.
This repository contains a full Python virtualenv configured with a number of ORM libraries for testing/development. For a quick comparison of their APIs and links to specific documentation, see Part 3 of the Python SQLAlchemy Tutorial.
The libraries included here are:
- SQLObject
- SQLAlchemy
- Peewee
- PonyORM
- Load up the SourceTree git client
- Open the "Terminal" command line in SourceTree
cd
in to your project directory (usepwd
to show the current directory,ls
to list current files, andcd ..
to move up a level)- Clone this repository into your project directory using
git clone https://github.com/coventryuniversity/python-sql-libs.git venv
- If it worked, you will now have a
venv
folder inside your project directory
- If it worked, you will now have a
- Close SourceTree
You can now run any of your Python files from the command line (load it with cmd
from the Windows Start menu) using the command venv\Scripts\python.exe <filename.py>
from inside your project directory (use cd
to change directories, dir
to list current files, cd ..
to move up a level, and E:
to change to drive E, etc.)
- Your Python file(s) will be able to use the ORM libraries included
- Just import them as normal with
import sqlalchemy
orfrom sqlalchemy import Column, Integer, String
etc...
If you want to be able to use the libraries included here, then you need to run your Python scripts from the command line as described above. It will not work if you try to run the script from within IDLE or another editor. So, edit your files in IDLE or another editor, but run the file from the command line as above.