[AstroPy] Question about Atpy with MySQL

Thomas Robitaille thomas.robitaille at gmail.com
Mon May 23 18:40:06 EDT 2011


Hi Juan,

The issue is that the options for MySQL in ATpy are not user/password/database, but user/passwd/db. See the full API here:

http://atpy.github.com/format_sql.html

So in your case, try:

import atpy
t = atpy.Table('mysql', user='juan', passwd='XXXX', db='BigGalaxies', \
table='CompareParams', \
query='SELECT * FROM CompareParams;' )

By the way, if the query is just to select all rows from a table, you don't need to specify query="select * from table;" as that is the default.

Let me know if this does not solve your issue!

Cheers,
Tom


On Monday, May 23, 2011 at 4:38 PM, Dr. Juan E Cabanela Ph.D. wrote: 
> I am new to python, trying to convert myself from the pain that is the current combination of perl, C, FORTRAN, and MySQL that I use for my research.
> 
> I have been trying to implement a MySQL query in ATpy to my MySQL 5.5.12 database. I have ATpy 0.9.5.1 and MySQL-Python 1.2.3 installed.
> 
> Whenever I try to issue a query like the following (in my case in the 'ipython -pylab' environment):
> 
> import atpy
> t = atpy.Table('mysql', user='juan', password='XXXX', database='BigGalaxies', \
>  table='CompareParams', \
>  query='SELECT * FROM CompareParams;' )
> 
> I get the following error:
> 
> TypeError: 'password' is an invalid keyword argument for this function
> 
> If I am interpreting the trace error correctly, the ultimate error get
> traced to MySQLdb/connections.pyc. I suspect this means my MySQL-python installation
> is bad. 
> 
> Does anyone have any advice/wisdom for resolving this sort of error? 
> 
> Juan
> 
> -- 
> Dr. Juan Cabanela 218-477-2453 (V) 218-477-2290 (F)
> Minnesota State University Moorhead WWW: http://www.cabanela.com/ 
> Dept. of Physics and Astronomy Twitter: Juan_Kinda_Guy 
> 1104 Seventh Ave South, Hagen 307B IM: AstroJuanCab (AIM) 
> Moorhead, MN 56563 cabanela at mnstate.edu (MSN)
> juancab at gmail.com (GTalk)
>  Public PGP Key available at: http://www.cabanela.com/juan_public.asc
> 
> 
> 
> 
> 
> 
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
> 




More information about the AstroPy mailing list