On Tue, Nov 8, 2011 at 10:02 AM, Songhun Kim <songhun....@gmail.com> wrote: > Hi. every one. > I'm a beginner in django. > I wrote a code for insert to mysql. > ex) > model_for_test = ModelTest(column01=postvalue1, column02=postvalue2...) > model_for_test.save() > This code made a query have no quotes like "insert ... values ( aaa, bbb ... > );". > So a mysql returns error. > Interested thing, It is worked well in mysql on my computer(mac), but not > worked in mysql on AWS. > > BTW, I want to fix a code make a having quotes query all the time. > Have you any idea for this?
Django *does* include the quotes on every query. However, the debug assistance provided can be a little misleading. If you ask a query to output its SQL, what is displayed is not exactly equivalent to what is passed to the underlying query engine. Django uses a standard Python database API to access the database. That database API specifies the way that arguments are passed in to queries (which handles the quoting automatically), but doesn't provide a way to (easily and quickly) extract the *literal* SQL that was ultimately executed. For debugging purposes, the query generates a quick approximation of the SQL corresponding to a query, but that SQL isn't 100% exactly the same as that seen by the database. If your query is working on a Mac, but not on AWS, the problem isn't likely to be quoting -- it's more likely to be: 1) A connection/permissions problem accessing the AWS database instance 2) Some difference between the database installed on your Mac, and the database installed on AWS. In the case of (2) It isn't enough to just say "They're both MySQL" -- MySQL (and, for that matter, any other database) have *thousands* of configuration options, all of which can affect the way that queries are executed. However, without any details about the errors you're seeing, we can't provide any more help. All I can tell you is that it's almost certainly *not* quoting that is the source of your problem. Yours, Russ Magee %-) -- 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.