469,592 Members | 1,741 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

Storing data

50
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
Aug 18 '07 #1
4 1395
bartonc
6,596 Expert 4TB
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.
Aug 18 '07 #2
kdt
50
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
Aug 18 '07 #3
bartonc
6,596 Expert 4TB
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:
Expand|Select|Wrap|Line Numbers
  1. class recordset:
  2.     attr1 = value1
  3.     # etc.
  4.  
  5. # or
  6.  
  7. recordset = (
  8. (val1, val2, etc)
  9. (val1, val2, etc)
  10. (val1, val2, etc)
  11. (val1, val2, etc)
  12. )
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.
Aug 18 '07 #4
kdt
50
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:
Expand|Select|Wrap|Line Numbers
  1. class recordset:
  2.     attr1 = value1
  3.     # etc.
  4.  
  5. # or
  6.  
  7. recordset = (
  8. (val1, val2, etc)
  9. (val1, val2, etc)
  10. (val1, val2, etc)
  11. (val1, val2, etc)
  12. )
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 :)
Aug 18 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Francisco | last post: by
1 post views Thread by Kay | last post: by
6 posts views Thread by bissatch | last post: by
1 post views Thread by VMI | last post: by
6 posts views Thread by Kyle Teague | last post: by
20 posts views Thread by Martin Jørgensen | last post: by
7 posts views Thread by Mike | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.