On Tue, 5 Sep 2006 09:45:51 -0400 Michael Bayer <[EMAIL PROTECTED]> wrote:
> if a Table is already set up for that engine, its going to use the > existing Table, instead of autoloading again. this is per MetaData > object. when you make the table like below with "engine", a > MetaData is created automatically, but its hidden. > > you might want to try creating a Table with a MetaData object > instead of straight to the engine, that way you can make a new > MetaData that will load the tables fresh from the db when you create > the Table. > Thanks Michael, my problem is that sometimes the planning table is already created and the program ALTER this table if necessary to add a new instrument. In the other case the planning table is created on fly like above. In the planning table structure the rows are the instruments and the primary key are the days of a selected month. So in the first case the new instrument also if it appears in the database planning table, there isn't a way to reload the table to show this new instrument. In the second case there isn't the problem. Is it correct? # Check the existence of the table. tablename depends on the month # selected existtable=self.checktable(tablename) # The table doen't exist, create it if not existtable: rec='' for i in range(len(self.instruments)): rec='%s %s VARCHAR(50), ' % (rec,self.instruments[i].name) self.engine.execute("CREATE TABLE %s (gg INT NOT NULL, day VARCHAR(3), %s, PRIMARY KEY (gg))" % (tablename, rec[:-2])) dmonth=calendar.monthcalendar(int(year), mmm) for dd in range(len(dmonth)): for mm in range(len(dmonth[dd])): if dmonth[dd][mm] == 0: continue self.engine.execute("INSERT INTO %s VALUES (%d,\'%s\')" % (tablename, dmonth[dd][mm], days[mm])) # Else load the existing table planning_table=Table(tablename, self.engine, autoload=True) > On Sep 5, 2006, at 7:02 AM, Enrico Morelli wrote: > > > Dear, > > > > I have a little problem using CherryPy and SQLAlchemy. > > I'm writing a program to manage the planning usage of our > > instrumentation. > > In a method I can add a new instrument and the procedure ALTER a > > planning table adding the new instrument. With a psql I see that the > > alteration is correct, the planning table has the new field. > > > > But when I display the planning table, the field there isn't. > > Eg. I added av1300 instrument and in the planning table appears: > > > > psql> \d planning_set_2006 > > > > gg | integer | not null > > day | character varying(3) | > > av1000 | character varying(50) | > > av200 | character varying(50) | > > av400 | character varying(50) | > > av500 | character varying(50) | > > av600 | character varying(50) | > > av700 | character varying(50) | > > av700b | character varying(50) | > > av700wb | character varying(50) | > > av800 | character varying(50) | > > av900 | character varying(50) | > > relaxometer | character varying(50) | > > av1200 | character varying(50) | > > av1300 | character varying(50) | > > > > But using the method that open the planning the new instrument there > > isn't: > > > > tablename='planning_set_2006' > > planning_table=Table(tablename, self.engine, autoload=True) > > > > for f in planning_table.columns: > > print f > > > > planning_set_2006.gg > > planning_set_2006.day > > planning_set_2006.av1000 > > planning_set_2006.av200 > > planning_set_2006.av400 > > planning_set_2006.av500 > > planning_set_2006.av600 > > planning_set_2006.av700 > > planning_set_2006.av700b > > planning_set_2006.av700wb > > planning_set_2006.av800 > > planning_set_2006.av900 > > planning_set_2006.relaxometer > > planning_set_2006.av1200 > > > > > > If I stop the CherryPy server and starts it again, the new > > instrument is displayed in the planning. There are some reasons for > > this behaviour? > > > > Thanks. > > > > -- > > ------------------------------------------------------------------- > > (o_ > > (o_ //\ Coltivate Linux che tanto Windows si pianta da solo. > > (/)_ V_/_ > > +------------------------------------------------------------------+ > > | ENRICO MORELLI | email: [EMAIL PROTECTED] | > > | * * * * | phone: +39 055 4574269 | > > | University of Florence | fax : +39 055 4574253 | > > | CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY | > > +------------------------------------------------------------------+ > > > > ---------------------------------------------------------------------- > > --- > > 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 > > Sqlalchemy-users@lists.sourceforge.net > > 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 Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users -- ------------------------------------------------------------------- (o_ (o_ //\ Coltivate Linux che tanto Windows si pianta da solo. (/)_ V_/_ +------------------------------------------------------------------+ | ENRICO MORELLI | email: [EMAIL PROTECTED] | | * * * * | phone: +39 055 4574269 | | University of Florence | fax : +39 055 4574253 | | CERM - via Sacconi, 6 - 50019 Sesto Fiorentino (FI) - ITALY | +------------------------------------------------------------------+ ------------------------------------------------------------------------- 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 Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users