[Sqlalchemy-commits] [1116] sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py: a few tweaks to get
Brought to you by:
zzzeek
From: <co...@sq...> - 2006-03-08 22:33:08
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:':';} #msg dl, #msg dt, #msg ul, #msg li { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[1116] sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py: a few tweaks to get table creates/reflection working</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>1116</dd> <dt>Author</dt> <dd>zzzeek</dd> <dt>Date</dt> <dd>2006-03-08 16:32:55 -0600 (Wed, 08 Mar 2006)</dd> </dl> <h3>Log Message</h3> <pre>a few tweaks to get table creates/reflection working table names are always reflected back as having lowercase names</pre> <h3>Modified Paths</h3> <ul> <li><a href="#sqlalchemytrunklibsqlalchemydatabasesoraclepy">sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="sqlalchemytrunklibsqlalchemydatabasesoraclepy"></a> <div class="modfile"><h4>Modified: sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py (1115 => 1116)</h4> <pre class="diff"><span> <span class="info">--- sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py 2006-03-08 22:11:51 UTC (rev 1115) +++ sqlalchemy/trunk/lib/sqlalchemy/databases/oracle.py 2006-03-08 22:32:55 UTC (rev 1116) </span><span class="lines">@@ -123,13 +123,14 @@ </span><span class="cx"> return OracleDefaultRunner(self, proxy) </span><span class="cx"> </span><span class="cx"> def reflecttable(self, table): </span><del>- c = self.execute ("select COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE, DATA_DEFAULT from USER_TAB_COLUMNS where TABLE_NAME = :table_name", {'table_name':table.name}) </del><ins>+ c = self.execute ("select COLUMN_NAME, DATA_TYPE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, NULLABLE, DATA_DEFAULT from USER_TAB_COLUMNS where TABLE_NAME = :table_name", {'table_name':table.name.upper()}) </ins><span class="cx"> </span><span class="cx"> while True: </span><span class="cx"> row = c.fetchone() </span><span class="cx"> if row is None: </span><span class="cx"> break </span><span class="cx"> </span><ins>+ #print "ROW:" , row </ins><span class="cx"> (name, coltype, length, precision, scale, nullable, default) = (row[0], row[1], row[2], row[3], row[4], row[5]=='Y', row[6]) </span><span class="cx"> </span><span class="cx"> # INTEGER if the scale is 0 and precision is null </span><span class="lines">@@ -163,17 +164,17 @@ </span><span class="cx"> where UCC.CONSTRAINT_NAME = UC.CONSTRAINT_NAME </span><span class="cx"> and UC.R_CONSTRAINT_NAME = UC2.CONSTRAINT_NAME(+) </span><span class="cx"> and UCC.TABLE_NAME = :table_name </span><del>-order by UCC.CONSTRAINT_NAME""",{'table_name' : table.name}) </del><ins>+order by UCC.CONSTRAINT_NAME""",{'table_name' : table.name.upper()}) </ins><span class="cx"> while True: </span><span class="cx"> row = c.fetchone() </span><span class="cx"> if row is None: </span><span class="cx"> break </span><del>- </del><ins>+ #print "ROW:" , row </ins><span class="cx"> (cons_name, column_name, type, search, referred_table) = row </span><span class="cx"> if type=='P' : </span><span class="cx"> table.c[column_name.lower()]._set_primary_key() </span><span class="cx"> elif type=='R': </span><del>- remotetable = Table(referred_table, table.engine, autoload = True) </del><ins>+ remotetable = Table(referred_table.lower(), table.engine, autoload = True) </ins><span class="cx"> table.c[column_name.lower()].append_item(schema.ForeignKey(remotetable.primary_key[0])) </span><span class="cx"> </span><span class="cx"> def last_inserted_ids(self): </span><span class="lines">@@ -310,7 +311,7 @@ </span><span class="cx"> if column.primary_key and not override_pk: </span><span class="cx"> colspec += " PRIMARY KEY" </span><span class="cx"> if column.foreign_key: </span><del>- colspec += " REFERENCES %s(%s)" % (column.column.foreign_key.column.table.name, column.column.foreign_key.column.name) </del><ins>+ colspec += " REFERENCES %s(%s)" % (column.foreign_key.column.table.name, column.foreign_key.column.name) </ins><span class="cx"> return colspec </span><span class="cx"> </span><span class="cx"> def visit_sequence(self, sequence): </span></span></pre> </div> </div> </body> </html> |