Hello !

I assume my question is stupid but I was not able to find something in the 
documentation or in internet.

I need to map a dictionary with strings as keys and string as values. 

*For example:*

from sqlalchemy import Column, Integer, String
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base

engine = create_engine('sqlite:///foo.db')
Base = declarative_base()

class Player(Base):
    __tablename__ = 'players'
    id = Column(Integer, primary_key=True)
    name = Column(String(64))

    shortcuts = {}

    def __init__(self, name):
        self.name = name

pierre = Player("pierre")
pierre.shortcuts["n"] = "north"
pierre.shortcuts["s"] = "south"

print(pierre.shortcuts)


*Output:*

>>> 
{'n': 'north', 's': 'south'}
>>> 


How should I proceed to map shortcuts ? I could use a PickleType but I need 
to be able to requete it with SQL...

Thank you !

Olaf

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to