By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,171 Members | 776 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,171 IT Pros & Developers. It's quick & easy.

Storing data

P: 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
Share this Question
Share on Google+
4 Replies


bartonc
Expert 5K+
P: 6,596
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

P: 50
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
Aug 18 '07 #3

bartonc
Expert 5K+
P: 6,596
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

P: 50
kdt
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.