After spending a sleepless night I make the head of the table definition, what I could do was the same body.
Please if anyone knows how to do this or have an idea for answer. python code: ------------------------------------------------------------------------ import dia, sys, os, string class MySqlRenderer : def __init__ (self) : self.f = None # the bintmap exporters calculate their ow margins from the bunding box def begin_render (self, data, filename) : self.f = open(filename, "w") name = os.path.split (filename)[1] self.f.write ("-- DiaSql-Dump\n-- version 0.01\n--Filename: %s\n" % (name,)) for layer in data.layers : self.WriteTables (layer) def WriteTables (self, layer) : for o in layer.objects : r = o.bounding_box if o.properties.has_key ("name") : url = o.properties["name"].value elif o.properties.has_key ("text") : url = o.properties["text"].value.text else : continue if len(url) == 0 or string.find (url, " ") >= 0 : continue self.f.write ('\n--\nCREATE TABLE IF NOT EXISTS `%s` (\n' % (url)) self.f.write ('\t\t...\n') self.f.write (') ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n') def end_render (self) : self.f.write ('--end MySQL-Dump\n') self.f.close() # reference dia.register_export ("MySQL Dump", "sql", MySqlRenderer()) 2010/8/12 fitorec <chane...@gmail.com> > I am fitorec, I am interested in develop a Dia-Python-Plugin for a dump sql > . I wrote the following code: > > import sys, dia > > class SqlRenderer : > def __init__ (self) : > self.f = None > > def _open(self, filename) : > self.f = open(filename, "w") > > def begin_render (self, data, filename) : > self._open (filename) > self.f.write('''-- DiaSql-Dump > -- version 0.01 > -- > ''') > for layer in data.layers : > for o in layer.objects : > #types which are valid?? > if o.type.name == "DATABASE - Class" : > > def end_render (self) : > self.f.write('-- end Dump') > self.f.close() > > dia.register_export ("SQL plain", "sql", SqlRenderer()) > > General problems that I had not know the models, their properties and > methods of DIA, I would like to see if they can send me some information API > --A plugin that works the Database Diagrams greatly help me--. > > I read the documentation http://live.gnome.org/Dia/Python but, I did not > find any reference that could help. > > thanks in advance. > > PS sorry my english is very bad. > > > 2010/8/12 <dia-list-requ...@gnome.org> > > Welcome to the dia-list@gnome.org mailing list! >> >> To post to this list, send your email to: >> >> dia-list@gnome.org >> >> General information about the mailing list is at: >> >> http://mail.gnome.org/mailman/listinfo/dia-list >> >> If you ever want to unsubscribe or change your options (eg, switch to >> or from digest mode, change your password, etc.), visit your >> subscription page at: >> >> http://mail.gnome.org/mailman/options/dia-list/chanerec%40gmail.com >> >> You can also make such adjustments via email by sending a message to: >> >> dia-list-requ...@gnome.org >> >> with the word `help' in the subject or body (don't include the >> quotes), and you will get back a message with instructions. >> >> You must know your password to change your options (including changing >> the password, itself) or to unsubscribe. It is: >> >> kaneodiz >> >> Normally, Mailman will remind you of your gnome.org mailing list >> passwords once every month, although you can disable this if you >> prefer. This reminder will also include instructions on how to >> unsubscribe or change your account options. There is also a button on >> your options page that will email your current password to you. >> > >
_______________________________________________ dia-list mailing list dia-list@gnome.org http://mail.gnome.org/mailman/listinfo/dia-list FAQ at http://live.gnome.org/Dia/Faq Main page at http://live.gnome.org/Dia