On Tue, Apr 26, 2016 at 4:42 PM, Mike Bayer <mike...@zzzcomputing.com> wrote:
>
> So first we'll take a breath....breathe...and we're back.  The best thing
> about air is that it's in most places we live and it's free.

Breathing is very important indeed :) I highly recommend taking
freediving course to anyone – 5 minutes without breathing is really
unique experience.

>  So going back
> to the link I sent,
> http://docs.sqlalchemy.org/en/rel_1_0/core/ddl.html?highlight=createtable#sqlalchemy.schema.CreateColumn
> , scroll down and the second example illustrates how to get the default DDL
> for the column, as rendered by the current compiler, here is a 5 second
> adaptation of that:
>
> from sqlalchemy.schema import CreateColumn
>
> @compiles(CreateColumn, "oracle")
> def _do_thing(element, compiler, **kw):
>     text = compiler.visit_create_column(element, **kw)
>     text = text.replace("NOT NULL", "NULL")
>     return text
>
> I hope this helps.

I own you explanation which I should have written in my last post. In
the end the need to change nullability concerned only one table so I
went with

elif engine.dialect.name == 'oracle':  # pragma: no cover
    Node.name.prop.columns[0].nullable = True

in Kotti framework which works.

Questions I asked in my last post are concerned more with implementing
IDENTITY for Oracle. Here the situation is not so simple and simply
replacing text is not possible as "GENERATE AS IDENTITY" phrase must
be placed in right order with regard to other keywords. That's what
made me looking at DDLCompiler.get_column_specification() and what
lead me to asking the questions I asked. I assure you I've read the
link you sent before asking my questions. This example just doesn't
seem to answer those questions.

I'd like you to know that I'm treating our conversation as occasion to
learn more about SA and to know how things should be done. Replacing
NOT NULL with NULL or vice versa is just very specific way of solving
particular problem and does not bring me closer to knowing how to
manipulate DDL for column creation in general.


Regards,
Piotr Dobrogost

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to