There is no need to reformat your data into cvs or dat files if you already have other ways of accessing it directly in your Python process. The .dat format is more of a convenience for users that are moving models over from AMPL. In 90% of cases, you can use the same .dat files. However, our .dat file parser is written in Python, whereas the AMPL version is written in C, so the performance hit can be large in our case.
Python gives you access to a vast toolset for managing data on your own, take advantage of it when you can. If load the data yourself (using some database API), you can use it directly in constraint expressions or to initialize model parameters. E.g.,
model.index = Set(initialize=data[’s’])
model.p = Param(model.index, initialize=data[‘p’])
This can type of declaration can be used whether or not ‘model' is Abstract or Concrete.
Gabe