Python 3.3.2 - How to Set Out a Small Database? -


i creating small database 'trial', per se. have tried few setting outs ([{key: value}, {key: value}]. but, need solution can called id (12345), name (rob alsod), area (a4 (like apartment building)), or job (manager, administrator, etc). so, dictionary (which can called one key) not work. tried making 'person' class, need way keep track of classes, , assign them easily. example,

for whatever in whatever:     = person(name = 'rob alsod', id = 12345, job = 'admin', area = 'a1')   # can make iterate with? (badly formed question) 

my point is, loops through, cannot assign same thing again , again.

could try make sense of saying, , suggest way format database?

you use sqlalchemy sqlite. sql queries few lines of code away:

from sqlalchemy import * db = create_engine('sqlite:///people.db')  metadata = metadata()  user = table('people', metadata, column('id', integer, primary_key = true), column('name', string(16), nullable = false), column('area', string(16)), column('job', string(60)) ) 

after easy connection = db.connect(); result = connection.execute("select id people")

on linux, pip , apt-get make install breeze well. hth, phil


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -