Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 24th, 2004, 06:09 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Question Accessing serialized data on DataBase

Hi.
The issue is that I'm using MySQL to store sessions.
In order to store objects for a session, I'm serialzing these objects.
Something like:
Tbl: Session
Fields : SessID as varchar (PK)
SessStart varchar (Session starting time)
SessTimeToLive int ( in seconds)
SessInfo -> the actual information stored in the session



I thought about 2 implementation and I don't know which one is better,
or wether there much better implementation than these:
1. Storing serialized data inside "SessInfo" as an xml doc
In orde to retrieve, I load it to DOM, Find the element by element name,
and de-serializing it's content.
2. Storing serialized data inside dictionary(value), and then serailizing the whole
dictionary.
for example in order to retrieve session data according to a key:
in the "SessInfo" there is currently -----serialized data-----
so:
de-serialize "SessInfo" -> {key1 : serialized value, key2 : serialized value}
get serialized value from key
de-serialize value


Hope I explained it good

Thank you very much
Roy

Reply With Quote
  #2  
Old February 24th, 2004, 06:17 PM
Strike Strike is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Houston, TX
Posts: 383 Strike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 27 sec
Reputation Power: 7
Send a message via ICQ to Strike Send a message via AIM to Strike Send a message via Yahoo to Strike
Just use one of Python's many serialization modules: cPickle and/or shelve would be most appropriate here.
__________________
Debian - because life's too short for worrying.
Best. (Python.) IRC bot. ever.

Reply With Quote
  #3  
Old February 24th, 2004, 06:36 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Quote:
Originally Posted by Strike
Just use one of Python's many serialization modules: cPickle and/or shelve would be most appropriate here.


I am wondering what is the best way to actually store the serialized data in the
DB ( xml that containes serialized data or maybe serialized dictionary)
, not how to serialize it.

Reply With Quote
  #4  
Old February 24th, 2004, 07:02 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,529 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 17 h 19 m 5 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
I'd probably go for the dictionary, mainly because it seems like it'll be more efficent than parsing an XML document to get the data. Plus pickeling a dictionary is infinatly easier

Mark.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #5  
Old February 25th, 2004, 05:29 PM
roypython roypython is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 71 roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level)roypython User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 h 20 m 49 sec
Reputation Power: 5
Quote:
Originally Posted by netytan
I'd probably go for the dictionary, mainly because it seems like it'll be more efficent than parsing an XML document to get the data. Plus pickeling a dictionary is infinatly easier

Mark.

Thanks Mark.
I'll try that

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Accessing serialized data on DataBase


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway