Storing data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kdt
    New Member
    • Mar 2007
    • 50

    Storing data

    Hi,

    This is my first attempt of making a standalone application, so I would appreciate any help on this :)

    I want to include in the program - that will be a .exe - a default dataset and give the user the option to use their own dataset.

    What is the best way to do this, the recordset is about 3000 records long. Should I hardcode this? Or is there a way to bundle the dataset as a text file with the program.

    Many thanks in advance
  • bartonc
    Recognized Expert Expert
    • Sep 2006
    • 6478

    #2
    Originally posted by kdt
    Hi,

    This is my first attempt of making a standalone application, so I would appreciate any help on this :)

    I want to include in the program - that will be a .exe - a default dataset and give the user the option to use their own dataset.

    What is the best way to do this, the recordset is about 3000 records long. Should I hardcode this? Or is there a way to bundle the dataset as a text file with the program.

    Many thanks in advance
    Hand code: No.
    3000 records? Too big for the registry.
    Hmmm: True data base? Sounds like there's one in the application (details would be nice); SQL?, etc. In that case, I'd use a SQL script (extracted from your own db) and have the target db execute it.

    Otherwise, the ConfigParser might be a good way to go.

    Comment

    • kdt
      New Member
      • Mar 2007
      • 50

      #3
      Hi BartonC,

      Thanks for the response. Currently I have the records in a text file that I open and read from a script. As I am trying to make the script a standalone application, and include the default dataset. Do you think it would be okay to bundle the text file with the program, and if the user selects "use default dataset" that it could just open "sample.txt " from there. I don't want to have to use a backend db with this. If I have to go down this route maybe sqllite would be a good idea?

      Cheers for the response

      Comment

      • bartonc
        Recognized Expert Expert
        • Sep 2006
        • 6478

        #4
        Originally posted by kdt
        Hi BartonC,

        Thanks for the response. Currently I have the records in a text file that I open and read from a script. As I am trying to make the script a standalone application, and include the default dataset. Do you think it would be okay to bundle the text file with the program, and if the user selects "use default dataset" that it could just open "sample.txt " from there. I don't want to have to use a backend db with this. If I have to go down this route maybe sqllite would be a good idea?

        Cheers for the response
        Not sure if a .txt file counts as a resource in an executable.
        Besides, if it's kept external, it's adjustable (like ini files).

        Nor have I played with SQLLite.

        What you could do is define your dataset in pure python:[CODE=python]class recordset:
        attr1 = value1
        # etc.

        # or

        recordset = (
        (val1, val2, etc)
        (val1, val2, etc)
        (val1, val2, etc)
        (val1, val2, etc)
        )[/CODE]and import that. This looks like hand coding, but could be generated from your text file.

        It's really just a text file, but as long is you use python syntax/import it'll work.

        Comment

        • kdt
          New Member
          • Mar 2007
          • 50

          #5
          Originally posted by bartonc
          Not sure if a .txt file counts as a resource in an executable.
          Besides, if it's kept external, it's adjustable (like ini files).

          Nor have I played with SQLLite.

          What you could do is define your dataset in pure python:[CODE=python]class recordset:
          attr1 = value1
          # etc.

          # or

          recordset = (
          (val1, val2, etc)
          (val1, val2, etc)
          (val1, val2, etc)
          (val1, val2, etc)
          )[/CODE]and import that. This looks like hand coding, but could be generated from your text file.

          It's really just a text file, but as long is you use python syntax/import it'll work.
          Hehe, very nice idea indeed, it should also be bundled with the .exe automatically now.

          Thanks :)

          Comment

          Working...