Discussion:
[Modeling-users] No semicolons in SQL
l***@poczta.fm
2003-11-11 18:53:26 UTC
Permalink
Hi

First, thanks to you Sebastien for quick and precise response about
"fetchSQL".

And I've got another problem:
Why there are no semicolons after every SQL expression generated by
mdl_generate_DB_schema.py? In "quick overview" example they are. I use
PostgreSQL and there the semicolons are required. After few recreations of
my database queries I'm tired with manually inserting this characters. As I
remember Oracle also requires them ( but MySQL doesn't).
I generate sql with mdl_generate_DB_schema.py and I don't get semicolons. Is
it caused by my shortage of knowledge how to get the semicolons or it is
some author's oversight? If it is my fault please give me some piece of
advice. Else maybe in the future releases some additional parameter to the
mdl_generate_DB_schema.py script could be added? For example:
mdl_generate_DB_schema.py -m
With -m the sql expressions would be generated with semicolons at the end,
else and default - without them.


SB> I'll also be pleased to hear from your own
SB> application, at least of the aggregations you're thinking about when
SB> asking this (if you can disclose): it always help to learn about the
SB> context in which feature requests raises.

Of course. Actually I'm learning Modeling Framework and trying to use it in
my application (bussines-portal in Zope(Plone)). As you see I've got many
problems with it :-) After the scheme of the database and queries will have
been completed I'll send you some description and 'aggregaton queries from
the real life' (I think that I'll do it outside the mailing list)

********************************
* Łukasz Łakomy
* Goodwill Internet Factory
*
* ***@gif.pl
********************************
Sebastien Bigaret
2003-11-11 20:32:03 UTC
Permalink
Post by l***@poczta.fm
Hi
First, thanks to you Sebastien for quick and precise response about
"fetchSQL".
Why there are no semicolons after every SQL expression generated by
mdl_generate_DB_schema.py? In "quick overview" example they are. I use
PostgreSQL and there the semicolons are required. After few recreations of
my database queries I'm tired with manually inserting this characters. As I
remember Oracle also requires them ( but MySQL doesn't).
[...]

Okay, there's two things, in fact. The generated SQL statements are w/o
any semi-colons. Now you make me notice that there is a problem on the
"quick overview" page: the line that says:

<<
Or create the database directly:
shell> mdl_generate_DB_schema.py -c -C \
--admin-dsn="localhost:template1:postgres:" sample_pymodel.py
Should say:
<<
shell> mdl_generate_DB_schema.py -C \
--admin-dsn="localhost:template1:postgres:" sample_pymodel.py
--> without the '-c' (== --stdout), this command issues the sql
statements directly to the db, without you having to copy-paste them
within the db cmdline (I've just corrected that, thanks). That's why
it needs the --admin-dsn option.
Post by l***@poczta.fm
I generate sql with mdl_generate_DB_schema.py and I don't get semicolons. Is
it caused by my shortage of knowledge how to get the semicolons or it is
some author's oversight? If it is my fault please give me some piece of
advice. Else maybe in the future releases some additional parameter to the
mdl_generate_DB_schema.py -m
With -m the sql expressions would be generated with semicolons at the end,
else and default - without them.
That's definitely not a lack of knowledge. In fact, this was reported
one+ month ago by Erny, check this thread:
https://sourceforge.net/mailarchive/forum.php?thread_id=3140798&forum_id=10674
(this discussion also exposes some other reasons why there is no
semi-colon after sql statements generated by the framework).

You'll find the related patch at:
https://sourceforge.net/tracker/index.php?func=detail&aid=812708&group_id=58935&atid=489338

With this patch, the sql statements generated by the script
'mdl_generate_DB_schema.py -c' have a semi-colon at their end by default.
Use option -e/--end-with to change that.

Now you now why I want to make a release in the coming days: I've been
''distracted'' too long ;)

BTW: I *never* close a bug ticket or a RFE before the correction/patch
is integrated in a released version, so you'll always be able to
find the latest fix on the bugs- & RFE- pages without having to use
CVS. This is probably something I should write somewhere in
clear...
Post by l***@poczta.fm
SB> I'll also be pleased to hear from your own
SB> application, at least of the aggregations you're thinking about when
SB> asking this (if you can disclose): it always help to learn about the
SB> context in which feature requests raises.
Of course. Actually I'm learning Modeling Framework and trying to use it in
my application (bussines-portal in Zope(Plone)). As you see I've got many
problems with it :-) After the scheme of the database and queries will have
been completed I'll send you some description and 'aggregaton queries from
the real life' (I think that I'll do it outside the mailing list)
That's fine, I can wait until then! However, do I understand you right
that you're about to test integration of MDL within plone products,
right? I've not played w/ Plone for a while, and I'm quite interested
in hearing from problems and progress in general. Maybe this could be
a good start for a tutorial, so if you're willing to and have some
time maybe we could collaborate on such a tutorial --just let me know.

-- Sébastien.

Loading...