MySQL-specific types arent present in the mysql module as of yet.   
they default to MSString when reflecting and cant be matched.  i  
committed an extra param "*extra" to the MSString constructor in  
revision 1654 to consume the extra arguments coming back from those  
types, so youll get better results.

On Jun 22, 2006, at 6:05 PM, Mike Bernson wrote:

> I am starting looking into what type of object come back for different
> column types from mysql.
>
> I am using version 0.2.3 with mysql version 5
>
> Here is error with a print statement near the problem turned on
>
> [EMAIL PROTECTED]:~/src/myranch/packages/screen/screen/views 276> python  
> test1.py
> coltype: 'tinyint' args: '(2)'
> args! ['2']
> coltype: 'tinyint' args: '(2)'
> args! ['2']
> coltype: 'smallint' args: '(2)'
> args! ['2']
> coltype: 'smallint' args: '(2)'
> args! ['2']
> coltype: 'int' args: '(2)'
> args! ['2']
> coltype: 'int' args: '(2)'
> args! ['2']
> coltype: 'int' args: '(2)'
> args! ['2']
> coltype: 'int' args: '(2)'
> args! ['2']
> coltype: 'bigint' args: '(10)'
> args! ['10']
> coltype: 'bigint' args: '(10)'
> args! ['10']
> coltype: 'double' args: '(10,4)'
> args! ['10', '4']
> coltype: 'double' args: '(10,4)'
> args! ['10', '4']
> coltype: 'float' args: '(10,4)'
> args! ['10', '4']
> Traceback (most recent call last):
>   File "test1.py", line 9, in ?
>     table = Table('testing', metadata, autoload=True)
>   File "/home/mike/src/SQLAlchemy-0.2.3/lib/sqlalchemy/schema.py",  
> line
> 96, in __call__
>     metadata.engine.reflecttable(table)
>   File "/home/mike/src/SQLAlchemy-0.2.3/lib/sqlalchemy/engine/ 
> base.py",
> line 484, in reflecttable
>     self.dialect.reflecttable(conn, table)
>   File
> "/home/mike/src/SQLAlchemy-0.2.3/lib/sqlalchemy/databases/mysql.py",
> line 207, in reflecttable
>     coltype = coltype(*[int(a) for a in args])
> TypeError: __init__() takes at most 2 arguments (3 given)
>
> Here is the python code:
> from pkg_resources import require
> require('SQLAlchemy')
>
> from sqlalchemy import *
>
> engine = create_engine("mysql:///wood_memorial")
> metadata = BoundMetaData(engine)
> table = Table('testing', metadata, autoload=True)
>
>
> here is the create for the table:
>
> use wood_memorial
>
> create table testing (
>         type_tiny TINYINT(2) DEFAULT 1,
>         type_utiny TINYINT(2) unsigned DEFAULT 2,
>         type_small SMALLINT(2) DEFAULT 1,
>         type_usmall SMALLINT(2) unsigned DEFAULT 2,
>         type_int INT(2) DEFAULT 2,
>         type_uint INT(2) unsigned,
>         type_integer INTEGER(2) DEFAULT 2,
>         type_uinteger INTEGER(2) unsigned,
>         type_bigint BIGINT(10),
>         type_ubigint BIGINT(10) unsigned,
>         type_double DOUBLE(10,4),
>         type_udobule DOUBLE(10,4) unsigned,
>         type_float FLOAT(10,4),
>         type_ufloat FLOAT(10,4) unsigned,
>         type_decimal DECIMAL(10,4),
>         type_udecimal DECIMAL(10,4) unsigned,
>         type_numeric NUMERIC(10,4),
>         type_unumeric NUMERIC(10,4) unsigned,
>         type_date DATE,
>         type_time TIME,
>         type_timestape TIMESTAMP,
>         type_datetime DATETIME,
>         type_year YEAR,
>         type_char_ascii CHAR(10) ASCII,
>         type_char_unicode CHAR(10) ASCII,
>         type_varchar VARCHAR(10),
>         type_unum enum('1','2','3')
>
> )
>
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to