I have set mysql tables to be innodb by default.  Data inserted using
sqlalchemy models never written to mysql innodb talbe.  Innodb table
is empty.  If I try to insert data into the myisam tables, all the
data get written to those tables.  Here is the log of sqlalchemy
insertion on innodb tables.  For every insert, I see BEGIN and there
aren't any corresponding commit each insert.

Sqlalchemy log:

INFO:sqlalchemy.engine.base.Engine.0x..cL:BEGIN
INFO:sqlalchemy.engine.base.Engine.0x..cL:INSERT INTO lookup
(username, shardname) VALUES (%s, %s)
INFO:sqlalchemy.engine.base.Engine.0x..cL:['0', 'shard1']
INFO:sqlalchemy.engine.base.Engine.0x..4c:BEGIN
INFO:sqlalchemy.engine.base.Engine.0x..4c:INSERT INTO lookup
(username, shardname) VALUES (%s, %s)
INFO:sqlalchemy.engine.base.Engine.0x..4c:['1', 'shard2']

==============================================
#!/usr/bin/env python

import datetime, os
from sqlalchemy import *
from sqlalchemy import exceptions, sql
from sqlalchemy.orm import *
from sqlalchemy.orm.shard import ShardedSession
from sqlalchemy.sql import operators

from sqlalchemy import create_engine

from blog_engine import *
from lookup import Lookup
from post import Post
from post_config import sesslk

from elixir import *
import md5

from lookup_config import *

def load_data():
        load_data_lookup()

def load_data_lookup():
    session = None
    setup_all()

    for i in  range(DATA):

        username1 = u"%d" % (i)
        hasha = md5.new()
        hasha.update("%s" % username1)
        valuea = hasha.digest()
        remhexa = valuea.encode("hex")


        rema = long(remhexa, 16)% SHARD

        m1 = Lookup(username="%d" % (i),
shardname=shard_lookup_dict['%s' % rema])
        sess = create_session_lookup()
        sess.begin()
        sess.save(m1)
        sess.commit()
        sess.clear()

if __name__ == '__main__':
    load_data()

=======================================================================
from elixir import *

from sqlalchemy.orm.shard import ShardedSession
from datetime import datetime
from my_metadata import a_metadata

import time

__metadata__ = a_metadata
__session__ = None

class Lookup(Entity):
    using_options(tablename='lookup')
    id = Field(Integer(),  primary_key = True)
    username = Field(String(30),  nullable = False, unique=True)
    shardname = Field(String(100), nullable = False)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to