#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    26
    Rep Power
    0

    List combination


    I am new to python, pls bear with me....

    I have an object oriented database with the following folder structure

    User1
    -->UserInfo
    -->CurrentUserStatus

    User2
    --> UserInfo
    --> CurrentUserStatus

    etc...

    I want to create a list of an object of some kind which contains all users with thier corresponding userInfo and UserStatus

    Some User's CurrentUserStatus might be empty, in which case I want to insert an Empty CurrentUserStatus for those users, but userInfo is always present

    I need this list of object so I can iterate thru it and easily access each user's info and status.

    How do I go about this

    I am thinking a need to create a container object that will contain the info and status, read thru the folder structure and populate this container object.

    I am looking for an efficient way to do this
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Iran
    Posts
    149
    Rep Power
    140
    If you're communicating with a database (oracle, MySQL, ...) from python, it depends on the technology/framework you're using, that is, how you retrieve data.

    For example in Django, when you select, you can actually put them directly in a list.

    So, how to you retrieve data from the database?


    Regards,
    Dariyoosh
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    26
    Rep Power
    0

    Arrow


    Originally Posted by dariyoosh
    If you're communicating with a database (oracle, MySQL, ...) from python, it depends on the technology/framework you're using, that is, how you retrieve data.

    For example in Django, when you select, you can actually put them directly in a list.

    So, how to you retrieve data from the database?


    Regards,
    Dariyoosh
    for user in db.objectRange(dirname=dbPath ):
    Users.append(db.readobj( dbPath.path()) )

    something like that - Linq like queries

IMN logo majestic logo threadwatch logo seochat tools logo