The database user and *nix user are (typically) unrelated. The database user is specified in settings.py and there is also a password if necessary. Since one usually communicates with database servers using network connections (even on the same box), it doesn't really know what user a connection came from.
Unless you are using sqlite3 as your database, in which case you just need to copy and change the ownership of the database file (may require sudo). On 2/16/12, Gchorn <guillaumech...@gmail.com> wrote: > Thanks very much for the reply. I went ahead and created a model > instance using the API, and then tried to get a yaml dump of this. > However, I'm running into another (newb) problem. The database I'm > using is under a different username (I'm doing all of this in Ubuntu > Linux 11.10), which I understood to be good practice. However, when I > do a python manage.py shell I have to already be in one user name or > another. The database username gives me access to the database > through the API, but then I can't create a data dump file because I > don't have file write access under that username. I can't be under > both usernames at once can I? Do I just need to give write-access to > the database username as well? If so how do I do that (I know we're > veering away from Django here, sorry)? > > On Feb 17, 1:13 am, Bill Freeman <ke1g...@gmail.com> wrote: >> Well, I don't know yaml, but if you are in a place where you don't >> have to quote: >> >> Arron >> >> then I'd expect everything to be strings. >> >> Is there a yaml.dump that you can apply to a model with strings and >> integers to see how it thinks they are distinguished? >> >> On 2/16/12, Gchorn <guillaumech...@gmail.com> wrote: >> >> >> >> >> >> >> >> > Hello All, >> >> > I'm attempting to provide initial data for my database using a fixture >> > file (like this: >> >https://docs.djangoproject.com/en/1.3/howto/initial-data/#providing-i...), >> > but I'm running into the following error: >> >> > Problem installing fixture '/home/guillaume/NBA/players/fixtures/ >> > player_data.yaml': Traceback (most recent call last): >> > File "/usr/local/lib/python2.7/dist-packages/django/core/management/ >> > commands/loaddata.py", line 169, in handle >> > for obj in objects: >> > File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/ >> > pyyaml.py", line 54, in Deserializer >> > for obj in PythonDeserializer(yaml.load(stream), **options): >> > File "/usr/local/lib/python2.7/dist-packages/django/core/serializers/ >> > python.py", line 122, in Deserializer >> > data[field.attname] = >> > field.rel.to._meta.get_field(field.rel.field_name).to_python(field_value) >> > File "/usr/local/lib/python2.7/dist-packages/django/db/models/fields/ >> > __init__.py", line 471, in to_python >> > raise exceptions.ValidationError(self.error_messages['invalid']) >> > ValidationError: [u'This value must be an integer.'] >> >> > Here is a sample from the YAML fixture file I'm attempting to use: >> >> > - model: players.player >> > pk: 2 >> > fields: >> > team: DEN >> > first_name: Arron >> > last_name: Afflalo >> > age: 26 >> > pos: SG >> > gp: 25 >> > mp: 754 >> > fg: 98 >> > fga: 227 >> > ft: 62 >> > fta: 78 >> > three_pointers: 31 >> > threes_attempted: 81 >> > orb: 15 >> > drb: 51 >> > ast: 39 >> > stl: 15 >> > blk: 6 >> > tov: 33 >> > pf: 55 >> > pts: 289 >> >> > Isn't what I have there mostly integers? I've already checked my >> > models.py file to make sure I didn't accidentally use an >> > "IntegerField" for "team", "first_name", "last_name", or "pos." Do I >> > need to include some other kind of formatting information in my YAML >> > file to indicate that the numbers are integers? >> >> > thanks, >> > Guillaume >> >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Django users" group. >> > To post to this group, send email to django-users@googlegroups.com. >> > To unsubscribe from this group, send email to >> > django-users+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> >http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.