Re: [sqlalchemy] Re: SQLAlchemy: Table creation before data insertion?

2014-12-16 Thread SF Markus Elfring
> take your Base object and
> 
> Base.metadata.create_all(engine)

Thanks for your helpful advice.

I have integrated it into a small script which I published a moment ago
together with a result from static source code analysis.

http://article.gmane.org/gmane.linux.kernel/1852033
https://lkml.org/lkml/2014/12/16/395
https://systeme.lip6.fr/pipermail/cocci/2014-December/001557.html

Are there still further improvement possibilities?

Regards,
Markus

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Re: SQLAlchemy: Table creation before data insertion?

2014-12-07 Thread Ed Rahn

take your Base object and

Base.metadata.create_all(engine)

On 12/08/2014 01:25 AM, SF Markus Elfring wrote:

http://docs.sqlalchemy.org/en/rel_0_9/core/metadata.html#sqlalchemy.schema.MetaData.create_all

I do not want to create meta-data in my use case explicitly.

Should the class library handle that for me automatically because of a
derivation from "declarative_base()"?

How can this automatism be informed to activate the desired tables
immediately?

Regards,
Markus



--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Re: SQLAlchemy: Table creation before data insertion?

2014-12-07 Thread SF Markus Elfring
> http://docs.sqlalchemy.org/en/rel_0_9/core/metadata.html#sqlalchemy.schema.MetaData.create_all

I do not want to create meta-data in my use case explicitly.

Should the class library handle that for me automatically because of a
derivation from "declarative_base()"?

How can this automatism be informed to activate the desired tables
immediately?

Regards,
Markus

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Re: SQLAlchemy: Table creation before data insertion?

2014-12-07 Thread Marco
Hi,
straight from the docs:

engine = create_engine('sqlite:///:memory:')
metadata = MetaData()
user = Table('user', metadata,
Column('user_id', Integer, primary_key = True),
Column('user_name', String(16), nullable = False),
Column('email_address', String(60), key='email'),
Column('password', String(20), nullable = False))
user_prefs = Table('user_prefs', metadata,
Column('pref_id', Integer, primary_key=True),
Column('user_id', Integer, ForeignKey("user.user_id"), nullable=False),
Column('pref_name', String(40), nullable=False),
Column('pref_value', String(100)))
SQL 
metadata.create_all(engine)


http://docs.sqlalchemy.org/en/rel_0_9/core/metadata.html#sqlalchemy.schema.MetaData.create_all


On Saturday, December 6, 2014 11:08:45 PM UTC-8, SF Markus Elfring wrote:
>
> Hello, 
>
> I try to convert a SQLite application to SQLAlchemy 0.9.7 on an openSUSE 
> system. 
>
> I followed the object relational tutorial. 
> Now I stumble on the message "sqlalchemy.exc.OperationalError: 
> (OperationalError) no such table: ...". 
>
> How should I trigger the desired table creation before my data will be 
> inserted there? 
>
> Regards, 
> Markus 
>

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.