you can use echo=True to metadata and/or logging to some extent. there was also some recipe about how to print some query's actual sql without issuing it, see recipes section at the site. but i'm not sure u can really do all you want without having a responding DB-api (which will at some point require a server). try, YMMV.
svil www.svilendobrev.com On Tuesday 31 March 2009 22:24:16 Yassen Damyanov wrote: > Max, > > I am an SA newbie so you should not take my words too seriously. > > So here's what I think: > > First, the only way to know and be sure that your code runs fine is > to run it against a real database server. MySQL is not that hard to > set up. (If you need help for that, let me know, I can help.) > > Second, if you mean that you want to generate the DDL (the tables > creation statements), then how about having SA run against a real > MySQL server and logging the SQL activity? (I guess this may sound > ugly but it will work with sure.) > > If you want to generate anything more than simply DDL, it looks to > me that a different approach will do a better job. > > (Advice from real experts is more than appreciated.) > Yassen > > On Tue, Mar 31, 2009 at 6:30 PM, Maxim Khitrov <mkhit...@gmail.com> wrote: > > Hello all, > > > > I'm working on a project for which I need to create sql files > > (the sort that you get from a database dump) without actually > > connecting to any database. The resulting code must be compatible > > with MySQL. > > > > My first inclination was to write a bunch of functions that > > contain sql code templates and substitute dynamic values where > > needed. I then came across SQLAlchemy and wanted to see if could > > use it to make this task a little easier. > > > > So far I've been reading the documentation on meta data and > > running some tests. My guess is that I need to define the > > statements and compile them with MySQLDialect. This, however, > > doesn't seem to be working. I tried calling compile on a Table > > object with dialect set to MySQLDialect(). When the result is > > printed there is nothing there (probably because I have no idea > > what I'm doing :)). > > > > Can anyone provide some tips on whether what I'm trying to do is > > possible, and if so, what is the best way to go about it? > > Basically, the output files will be a combination of create > > database, create table, insert, and update statements. I should > > also mention that I'm using Python 2.6 on Windows. The latest > > stable MySQL-Python extension doesn't support 2.6, and there > > doesn't seem to be a test version available for Windows. > > > > Even if the database API was available, there is no database for > > me to connect to. The goal is to generate these files on the > > local machine without depending on any external resources. > > Eventually, it may be possible to execute this code directly on > > the database server, which is why I think using SQLAlchemy from > > the beginning would make that transition much easier. Thanks for > > any help. > > > > - Max > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---