hello friends,

my other issue that floats on a multiple xsd scenario is a colliding type
name.
an arbitrary type name given to the root element of xsd2 is clashing with
one of the complex types in xsd1.
how could I identify the name of the root element in the supermod? I wish
to skip the table generation for it.


alex

On Sat, Sep 1, 2018, 16:03 Alex Bodnaru <alexb...@gmail.com> wrote:

> thank you dave, i will try to see how to harness this understanding to my
> issue.
>
> best regards,
> alex
>
>
> On Sat, Sep 1, 2018 at 3:01 AM Dave Kuhlman <dkuhl...@davekuhlman.org>
> wrote:
>
>> Alex,
>>
>> Thanks for the nudge on this.
>>
>> By "anonymous complex type", I assume you mean something like the
>> following:
>>
>>     <xs:element name="myelement">
>>         <xs:complexType>
>>         ...
>>         </xs:complexType>
>>     </xs:element>
>>
>> Since generateds needs to generate a class for each complex type, it
>> assigns names to the ones that lack them (basically the ones not at
>> top level).  That is done in `process_includes.py`.  Look at the
>> function `raise_anon_complextypes` in that file.  That function
>> works on the element tree created by Lxml;  it raises the
>> `complexType` element to top level (immediately under the root) and
>> gives it a name.  The line:
>>
>>     type_name = '%sType' % (name, )
>>
>> creates the name (initially), and then the function `unique_name`
>> attempts to ensure that it is unique.
>>
>> I suppose that could be parameterized, with yet another command line
>> option.  Do you think that is worth the effort?  Why do you need to
>> control it?
>>
>> Dave
>>
>> On Fri, Aug 31, 2018 at 10:14:59AM +0300, Alex Bodnaru wrote:
>> > Thank you very much, variation in contribution may lead to
>> collaboration.
>> >
>> > I did enjoy the tremendous value of original generateds, so please
>> enjoy my
>> > small addition too.
>> >
>> > but, btw, could you help with my question? I shamefully didn't find
>> where
>> > you set the name of the anonymous complex type following element 'xx' as
>> > 'xxType'. I would like to tweak the suffix.
>> >
>> > thanks,
>> > alex
>> >
>> > On Fri, Aug 31, 2018, 04:58 Bill Nichols <bnichol...@gmail.com> wrote:
>> >
>> > > This conversation promises good things 👍
>> > >
>> > > On Thu, Aug 30, 2018 at 7:59 PM Dave Kuhlman <
>> dkuhl...@davekuhlman.org>
>> > > wrote:
>> > >
>> > >> Alex,
>> > >>
>> > >> Very cool.
>> > >>
>> > >> Give me a little time to study this.  But, already, I can tell that
>> > >> you know some things that I do not.  I have some learning to do.
>> > >>
>> > >> More later.
>> > >>
>> > >> Dave
>> > >>
>> > >> On Thu, Aug 30, 2018 at 09:03:56AM +0300, Alex Bodnaru wrote:
>> > >> > ah, good you told me. mine is working, and was based on your django
>> > >> code.
>> > >> > i'm loading tables, foreign keys an manytomany relations, and their
>> > >> data.
>> > >> > all this is being generated from one xsd automatically. my code
>> will be
>> > >> > attached here.
>> > >> > although xsd can represent primary keys, mine doesn't have it, and
>> i'm
>> > >> > allowing the
>> > >> > user to set one per table, and one default pk field. if
>> inexistent, the
>> > >> pk
>> > >> > field will be
>> > >> > added as an auto incremented integer.
>> > >> > btw i'm performing the load of multiple xsd with multiple models
>> in one
>> > >> > run, importing
>> > >> > them in a main.py. this complexity somewhat broke the preservation
>> of
>> > >> older
>> > >> > files.
>> > >> > your generateDS.py has not changed at all.
>> > >> >
>> > >> > since my source data contains more than one xsd with overlapping
>> > >> entities,
>> > >> > and i've
>> > >> > got stuck when one table is being defined in one xsd as a named
>> complex
>> > >> > type,
>> > >> > but in the other, is being defined as a child type element of a
>> field,
>> > >> > hence it gets
>> > >> > the name of the field + 'Type'. i'd like to override this
>> particular
>> > >> > behaviour, at least the
>> > >> > field type dot to get the suffix, so it could match the table from
>> the
>> > >> > other xsd.
>> > >> >
>> > >> > thanks a lot for all your work,
>> > >> > alex
>> > >> >
>> > >> > On Thu, Aug 30, 2018 at 7:01 AM Dave Kuhlman <
>> dkuhl...@davekuhlman.org>
>> > >> > wrote:
>> > >> >
>> > >> > > Alex,
>> > >> > >
>> > >> > > You are welcome.  Hope generateds has been useful.
>> > >> > >
>> > >> > > Your work on an extension for SQLAlchemy sounds very
>> interesting.  I
>> > >> > > suspect that such a capability would be a very valuable addition.
>> > >> > >
>> > >> > > I'm working on something similar myself.  I'm hoping to be able
>> to
>> > >> > > generate an SQLAlchemy model from an XML schema, then use
>> > >> > > generateDS.py to generate a module contain export methods that
>> would
>> > >> > > load data from an XML instance document into a SQLAlchemy
>> database.
>> > >> > > I'm just now starting to study SQLAlchemy and am learning as I
>> go.
>> > >> > >
>> > >> > > And, by the way, Denis Sutyagin aka jabber contributed the
>> > >> > > code base for my work.
>> > >> > >
>> > >> > > I've also done some initial work on an analogous capability for
>> > >> > > generateds and Django.
>> > >> > >
>> > >> > > I'm thinking that this is in the area of an ETL capability for
>> > >> > > generateds and SQLAlchemy (and Django): extract, transform, and
>> > >> > > load, without very much emphasis on the transform part.  Wait.
>> > >> > > Maybe ... OK. I've added a hook for user transforms.  Although,
>> I'm
>> > >> > > groping about use-cases, which is likely obvious.
>> > >> > >
>> > >> > > I'm new to SQLAlchemy and am groping and learning about it as I
>> work
>> > >> > > on this.  So, it will likely be some time in the future before I
>> > >> > > have something that works.
>> > >> > >
>> > >> > > Maybe someday we can compare notes and compare ideas on this.
>> > >> > >
>> > >> > > Dave
>> > >> > >
>> > >> > > On Wed, Aug 29, 2018 at 06:06:33PM +0300, Alex Bodnaru wrote:
>> > >> > > > hello my friends,
>> > >> > > >
>> > >> > > > a big thank for generateds.
>> > >> > > >
>> > >> > > > in an aim to load a db from xsd and xml data files, i had the
>> > >> pleasure to
>> > >> > > > develop an sql alchemy extension.
>> > >> > > > my only wish I didn't find a way to fulfill is to generate
>> anonymous
>> > >> > > types
>> > >> > > > without the 'Type' suffix.
>> > >> > > > however i tryed, my aim to do the change myself failed, since I
>> > >> didn't
>> > >> > > find
>> > >> > > > where un the code it's being done.
>> > >> > > >
>> > >> > > > thanks in advance,
>> > >> > > > alex
>> > >> > > >
>> > >> > > >
>> > >> > > > alex
>> > >> > >
>> > >> > > >
>> > >> > >
>> > >>
>> ------------------------------------------------------------------------------
>> > >> > > > Check out the vibrant tech community on one of the world's most
>> > >> > > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> > >> > >
>> > >> > > > _______________________________________________
>> > >> > > > generateds-users mailing list
>> > >> > > > generateds-users@lists.sourceforge.net
>> > >> > > > https://lists.sourceforge.net/lists/listinfo/generateds-users
>> > >> > >
>> > >> > >
>> > >> > > --
>> > >> > >
>> > >> > > Dave Kuhlman
>> > >> > > http://www.davekuhlman.org
>> > >> > >
>> > >> >
>> > >> >
>> > >> > --
>> > >> > --
>> > >> > alex
>> > >>
>> > >> --
>> > >>
>> > >> Dave Kuhlman
>> > >> http://www.davekuhlman.org
>> > >>
>> > >>
>> > >>
>> ------------------------------------------------------------------------------
>> > >> Check out the vibrant tech community on one of the world's most
>> > >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> > >> _______________________________________________
>> > >> generateds-users mailing list
>> > >> generateds-users@lists.sourceforge.net
>> > >> https://lists.sourceforge.net/lists/listinfo/generateds-users
>> > >>
>> > >
>>
>> --
>>
>> Dave Kuhlman
>> http://www.davekuhlman.org
>>
>
>
> --
> --
> alex
>
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to