Thanks, Mike! I have some studying to do...
On Wednesday, February 3, 2021 at 6:42:17 PM UTC-5 Mike Bayer wrote:
>
>
> On Wed, Feb 3, 2021, at 6:23 PM, Christian Henning wrote:
>
> Hi Mike,
>
> thanks for your advice! I'll make the changes.
>
> But let me ask you one t
e anything in the documentation?
Thanks,
Christian
On Wednesday, February 3, 2021 at 5:12:30 PM UTC-5 Mike Bayer wrote:
> the session.commit() method expires all attributes by default:
>
> https://docs.sqlalchemy.org/en/13/orm/session_basics.html#committing
>
> your code is or
hemy for 1.3.18 and 1.4.0b1. I'm using
python 3.9.1
When I rewrite the last few lines a bit the warning disappears. For
instance:
jack = User.create(session)
a = Address.create(session)
jack.addresses.append(a)
Any insight is appreciated. I'm still learning.
Thanks,
Christian
--
SQLAlchemy
Il giorno mercoledì 5 giugno 2019 18:17:48 UTC+2, Mike Bayer ha scritto:
>
>
>
> On Wed, Jun 5, 2019, at 12:02 PM, Christian Barra wrote:
>
> Hi, I am trying to understand what the best approach is to have lazy
> attributes defined on a mixin and then used them on the su
Hi, I am trying to understand what the best approach is to have lazy
attributes defined on a mixin and then used them on the subclasses.
Ideally I'd would like to defer the load of that attribute (controller) and
use `undefer` when I know that that attribute is needed, to execute only
one
Simon, thank you for your kind help.
working excerpt:
Base = declarative_base()
engine = create_engine(app.config.get('SQLALCHEMY_DATABASE_URI'))
metadata = MetaData(bind=engine)
Base.metadata = metadata
# load tables
metadata.reflect(autoload=True)
# load view, as standard reflection ignores
i fiddled around with this. here are some interessting perceptions.
defining the primary_key manually yields this, which is totally irrational
to me. the missing view that i am after is already defined somewhere?
p...
>>> my_view = Table("web_view", metadata, Column("NODE_ID", Integer,
maybe a "primary key" issue?
from the docs:
sually, it’s desired to have at least a primary key constraint when
reflecting a view, if not foreign keys as well. View reflection doesn’t
extrapolate these constraints.
Use the “override” technique for this, specifying explicitly those columns
ok, so we are back to the central question. the output below indictates
that only "tables" are reflected and "views" are ignored. i like to think
i am not the first who wants to use mysql views with sqla? is this really
such a difficult task?
>>> print(Base.classes.keys())
['attribs',
did not work out very well,...god, this stuff gives some good headache!
>>> from sqlalchemy.ext.automap import automap_base
>>> Base = automap_base(metadata=metadata)
>>> Base.prepare()
>>> WebView = Base.classes.web_view
Traceback (most recent call last):
File "", line 1, in
File
i already spent 3 days trying to map one stupid mysql view and i cant get
it to work.
in the python interpreter it works...
Python 2.7.5 (default, May 31 2018, 09:45:54)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
= await result.scalar()
Il giorno mercoledì 15 marzo 2017 14:37:29 UTC+1, Mike Bayer ha scritto:
>
> that's not SQLAlchemy, you're using this:
>
> https://github.com/aio-libs/aiopg/blob/master/aiopg/sa/result.py#L205
>
>
>
>
> On 03/15/2017 04:13 AM, Christian Barra wro
Hello,
I am trying to fetch the result of a query after an insert.
SQLAlchemy 1.16 and PostgreSQL 9.6
This is the code:
engine = self.request.app['db']
async with engine.acquire() as conn:
query = models.User.insert().values(email=email, first_name=
first_name,
d enough. I would not have done the CHECK constraint feature of
> enum/boolean by default if it were today it has caused enormous problems.
>
> On 01/05/2017 09:01 AM, Tim-Christian Mundt wrote:
>> That works, thanks.
>>
>> There is no (easy) way to CHECK the elements of
core/type_basics.html?highlight=enum#sqlalchemy.types.Enum.params.create_constraint
>
>
>
> On 01/05/2017 01:34 AM, Tim-Christian Mundt wrote:
>> Hi,
>>
>> I've been using an array of enums with postgres and SQLAlchemy
>> successfully over the past year like
Hi,
I've been using an array of enums with postgres and SQLAlchemy successfully
over the past year like so:
class MyModel(BaseModel):
enum_field = Column(postgresql.ARRAY(EnumField(MyEnum, native_enum=False)))
The EnumField is from the sqlalchemy_enum34
> Am 11.05.2016 um 17:38 schrieb Mike Bayer <mike...@zzzcomputing.com>:
>
> On 05/11/2016 03:39 AM, Tim-Christian Mundt wrote:
>> Ok, a complete MCVE looks like that:
>>
>>
>> from sqlalchemy import Column, ForeignKey, Integer, S
.tags collection storing two
> TagAssociation objects when you've explicitly set the collection to store a
> single TagAssociation
I don’t get it, where do I set that?
> Am 05.05.2016 um 23:26 schrieb Mike Bayer <mike...@zzzcomputing.com>:
>
>
>
> On 05/03/2016 06:28
I have entities which I’d like to tag with tags from a vocabulary. The
associations between entities and tags are implemented with „manual M:N“,
because they carry more information.
class Entity(Base):
id = Column(Integer, primary_key=True)
tags = relationship('TagAssociation',
, all three
are committed, otherwise all three are rolled back (which is essentially a
two-phase commit protocol).
However, the zope solution is more generic and will come in handy in less
specialized scenarios.
Thanks,
Christian
--
You received this message because you are subscribed
for such
multi-thread transactions?
Thanks in advance,
Christian
--
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
Am Dienstag, 9. September 2014 18:12:26 UTC+2 schrieb Jonathan Vanasco:
What do you see if you drop SqlAlchemy's logging to DEBUG?
I think I had a similar problem a long time ago, migrating from 0.5 to
0.8. In my case, the issue was with the `Session` factory -- i was not
properly
in advance,
Christian
--
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
software, entity os,
assoc runs_on). What I currently do is iterate over the associations
of the parent and remove the matched child, but that seems inefficient.
Christian
(re-submitted because apparently being subscribed to the ML is required
to post to i)
--
You received this message because you
On 2014-04-05 16:58, Michael Bayer wrote:
On Apr 5, 2014, at 8:14 AM, Christian Kastner debian.kvr...@gmail.com wrote:
I have a many-many relationship implemented as an Association Object.
When I add an association between a parent and a child, the list of
associations within the parent
Thx all
NullPool solve my problem
create_engine(cnx_str, poolclass=NullPool)
2014-02-07 19:11 GMT+01:00 Claudio Freire klaussfre...@gmail.com:
On Fri, Feb 7, 2014 at 2:35 PM, Michael Bayer mike...@zzzcomputing.com
wrote:
The connection pool, if in use, will then not
actually close the
Hi all,
Actually, i have some problem closing my session...
I tried using scopedsession with session.remove
I tried using normal session with session.close
But in both cases, the Mysql session stay open.
Why closing session has no effet on current Mysql connections ?
--
You received this
, in _unsupported_impl
NotImplementedError: Operator 'getitem' is not supported on this expression
It seems getitem should be allowed since the xpath expression returns an
array of nodes (and it is fine in PostgreSQL).
Any idea what I am doing wrong and how to fix it?
Thanks,
Christian
--
You
sqlalchemy import func, String
from sqlalchemy.dialects import postgresql
print func.xpath('something', 'somethingelse',
type_=postgresql.ARRAY(String()))[1].compile(dialect=postgresql.dialect())
xpath(%(xpath_1)s, %(xpath_2)s)[%(xpath_3)s]
On Dec 5, 2013, at 3:33 PM, Christian Lang
christia
://scott:tiger@localhost/test, echo=True)
idx.create(e)
the SQL itself still fails on PG (not familiar with the xpath function)
but it renders:
CREATE INDEX doc_idx ON xmltable (CAST(xpath('//@bla', doc)[1] AS TEXT))
On Dec 5, 2013, at 4:47 PM, Christian Lang
christia...@gmail.comjavascript
(
'//@bla',
xmlTable.c.doc,
type_=postgresql.ARRAY(String())
))[1],
TEXT)
)
On Dec 5, 2013, at 5:20 PM, Christian Lang
christia...@gmail.comjavascript:
wrote:
I see, thanks for clarifying.
I think
Let's say I have the following model:
class Molecule(Base):
db = Column(Integer, primary_key=True)
id = Column(Integer, primary_key=True)
data = Column(Integer)
class Atom(Base):
id = Column(Integer, primary_key=True)
weight = Column(Integer)
And I want to establish a
', 'molecule.id') ),)
And add the relatiohship to one of the models as usual, for example, in
Class Atom add:
molecules = relationship(Molecule, secondary=molecule2atom, backref=atoms)
On Thursday, March 7, 2013 10:16:24 AM UTC+1, Christian wrote:
Let's say I have the following model:
class
Hi,
AttributeError: 'NoneType' object has no attribute 'twophase'
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
Session already has a Connection associated for the
given Connection's Engine)
else:
conn =
, although marked for deletion, the
objects still have all of their state, including working references.
So … what's your take on that? :)
Christian
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To unsubscribe from this group and stop receiving
a session. If you run the attached code with SQLAlchemy (0.7 or
0.8) then the object stays alive, stays attached and the application can't
see that it has been deleted.
Is this intentional? Am I holding it wrong?
Thanks,
Christian
--
You received this message because you are subscribed to the Google
i check if the index is used in a select? Do i see it with
echo=True?
Thanks in advance...
Christian
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group
Hi all,
I have a very strange problem...
I have an application which runs under SQL Alchemy.
When my application is running and i launch OPTIMIZE TABLE in PhpMyAdmin,
my process blocks showing this error Waiting for metadata lock
When i close my application, the process unlocks.
What happen in
the same behaviour that classic many to
many relationship ?
I already try adding : creator=lambda x: x to my association proxies*
2012/3/27 Michael Bayer mike...@zzzcomputing.com
On Mar 27, 2012, at 4:35 AM, Christian Démolis wrote:
Up!
2012/3/23 Christian Démolis christiandemo...@gmail.com
Hi all,
class A(Base):
__tablename__ = 'a'
IdA = Column('IdA', Integer, primary_key=True)
AllTheB = association_proxy(many_to_many_relation, relation_b)
class ManyToManyRelation(
__tablename__ = 'many_to_many_relation'
IdA = Column(Integer, ForeignKey('A.IdA'),
(articke) object
and you save it !
PS: tarife ou tarif ?
On Thursday, March 15, 2012 12:38:26 PM UTC+1, Christian Démolis wrote:
Hi all,
DossierTarife = Table('tarifer_dossier', Base.metadata,
Column('IdDossier', Integer, ForeignKey('dossier.IdDossier'**)),
Column('IdAt
Hi,
right, it's that
thanks
2012/1/31 Tate Kim insight...@gmail.com
**
Hi,
Have you checked the __iter__ method ?
--
*From: * Christian Démolis christiandemo...@gmail.com
*Sender: * sqlalchemy@googlegroups.com
*Date: *Tue, 31 Jan 2012 17:39:54 +0100
Hi Michael,
i overload class Query in my script.
i have 4 ways to obtain query's results.
1/ session.query(model.x).all()
2/ session.query(model.x).first()
3/ session.query(model.x).one()
4/ for e in session.query(model.x):
print e
in case 1,2,3, i know which method is used
What method
= create_engine(DSN, echo=True)
Base.metadata.create_all(engine)
event.listen(SomeClass, after_create, DDL('ALTER SEQUENCE
some_table_seq NO_CACHE'))
But this does not work. What should i add instead of SomeClass?
Thanks in advance
Christian
--
You received this message because you are subscribed
Hi Michael,
thanks for input. If i find some time i will start...
Christian
On Jul 6, 2011, at 11:19 AM, Christian Klinger wrote:
Hi Michael,
i am intrested in writing a dialect for DB2. Is there any howto which covers
what is needed to start. Do you think we should write an extension
Hi Michael,
i am intrested in writing a dialect for DB2. Is there any howto which
covers what is needed to start. Do you think we should write an
extension, or should this dialect in sqlalchemy itself?
Thanks in advance
Christian
On Jun 29, 2011, at 6:43 AM, Luca Lesinigo wrote:
Hello
Hi all,
I have a question about many to many Table containing attribute.
How to access and write Max attribute in many to many table ?
I already read that but i try to not use mapper and stay in declarative mode
which is more user friendly :)
Okay it works
literal() and literal_column() functions works with sqlite but only
literal() function works with MySQLdb connector
Thanks a lot !)
2010/12/9 Michael Bayer mike...@zzzcomputing.com
On Dec 9, 2010, at 11:14 AM, Christian Démolis wrote:
Could not locate column in row for column
Hi,
SELECT IdActe, coucou
FROM `acte`
WHERE 1
How to attach a string to each result of a query ?
i try that but it doesn't work :(
s = model.session.query(milieu, model.Dossier.NomEntreprise,
model.Dossier.AgendaSensGroupement, model.Dossier.AgendaUnite, *Coucou*)
Thx
Chris
--
You
Hi,
I found a usecase that is illogical
Here is the first code and his result in term. All is *False*
milieu = model.aliased(model.Plage)
s2 = model.session.query(
milieu,
model.func.timediff(milieu.Fin, milieu.Debut),
*model.func.timediff(milieu.Fin,
strings and Python constructs to cursor.execute().
On Nov 18, 2010, at 5:04 AM, Christian Démolis wrote:
Hi,
I found a usecase that is illogical
Here is the first code and his result in term. All is *False*
milieu = model.aliased(model.Plage)
s2 = model.session.query
Hi,
Do you know how to do this query with sqlalchemy?
*SELECT
Id, TIMEDIFF( End, Start)
FROM
plage
WHERE
TIMEDIFF(End,Start)=TIME('02:20:00');*
In my model, Start and End are DateTime
Start = Column('Start', DateTime)
End = Column('End', DateTime)
--
You received this message because you are
Thanks
2010/10/14 Michael Bayer mike...@zzzcomputing.com
On Oct 13, 2010, at 10:48 AM, Christian Démolis wrote:
Hi,
q = model.session.query(
#
model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(),
model.Instruction.FinValidite==None
Hello,
I actually try to migrate to SqlAlchemy 0.6.4 (before i was in 0.5.2)
One of my query seems to not work properly in this new version
It seems to be a bug in Sql Alchemy because of this part of my query
*model.Collaborateur.LesIns.any(model.or_(model.Instruction.FinValiditetime.time(),
...@zzzcomputing.com
On Sep 20, 2010, at 10:37 AM, Christian Démolis wrote:
Hi,
Can i use SqlAlchemy in a non transactionnal way ?
How can i do it?
Session() has an autocommit=True flag that will commit every flush()
operation immediately and not retain an open transaction during usage. You
may
BTeilnehmer with:
BaseC.metadata.create_all(engine)
it gives me this traceback:
So any ideas or suggestions.
Thanks for your help
Christian
yeti:fernlehrgang cklinger$ bin/python create.py
2010-02-24 10:05:59,090 INFO sqlalchemy.engine.base.Engine.0x...3c10
SELECT USER FROM DUAL
2010-02-24 10:05
Ok,
i already use session.query, no problem with my code. It works very well at
the moment.
I m just curious about advanced functionnality of my favourite orm :)
Thanks to you, i have discovered that we can :
- define associationproxy
- define a properties which returns the result of a
Is it possible to put a filter on a relation in the declaration?
Example :
LeNomDuUtilisateur = relation(Utilisateur, filter_by=Utilisateur.Login,
backref=backref('verrouillage'))
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this
:18 +0100, Christian Démolis pisze:
Is it possible to put a filter on a relation in the declaration?
Example :
LeNomDuUtilisateur = relation(Utilisateur,
filter_by=Utilisateur.Login, backref=backref('verrouillage'))
I'm not sure what exactly your example means.. but if you want extra
Cool, it's very powerful, it will allow me to save my Bandwidth because i
take just what i want and not the entire object.
Thanks Conor
2009/11/24 Conor conor.edward.da...@gmail.com
Christian Démolis wrote:
Thx for your answer Thomas
I want the attribute to not return the complete object
i bind the
relation to the light object
It s a brutal method, i dont think if it can work...
2009/11/24 Conor conor.edward.da...@gmail.com
Christian Démolis wrote:
Cool, it's very powerful, it will allow me to save my Bandwidth
because i take just what i want and not the entire object
conor.edward.da...@gmail.com wrote:
Christian Démolis wrote:
Hi,
The idea of creating another column is good but it will multiplicate
the size of my table by 2 for nothing. Is it possible to use MYSQL
regular expression search with sql alcmehy? If yes, what is the
command?
MySQL
.
Cheers,
Andre
On Fri, Oct 9, 2009 at 5:46 AM, Christian Démolis
christiandemo...@gmail.com wrote:
Hi everybody,
I m stuck with a query about telephone number :
I want to find in my database all the contact who have a telephone
number.
The difficulty is that some number
Hello,
class sqlalchemy.sql.expression.ColumnOperators¶
Defines comparison and math operations.
__init__()¶
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
asc()¶
between(cleft, cright)¶
collate(collation)¶
concat(other)¶
contains(other,
Hi everybody,
I m stuck with a query about telephone number :
I want to find in my database all the contact who have a telephone number.
The difficulty is that some number in the database can have space or .
between numbers
example : 06.06.50.44.11 or 45 87 12 45 65
This my query with like but
Update 1000 SqlAlchemy 31.0309998989
It s crazy ^^
I don t know why my station is slow? Do u have an idea?*
2009/10/1 Michael Bayer mike...@zzzcomputing.com
Christian Démolis wrote:
Maybe because the database is in Tunisia and my Computer in France.
I don t use sqlite, i use MySQL.
I just
I does a mistake in my last, that is the results (error in parameters of
mysqldb connection)
Local database
Update 1000 MySQLdb 0.0319998264313
Update 1000 SqlAlchemy 0.265999794006
France-Tunisia
Update 1000 MySQLdb 10.391324
Update 1000 SqlAlchemy 42.157924
Sorry
2009/10/2 Christian
With ORM pure SQL 0.3123624
With MySQLdb without ORM 0.0940001010895
2009/9/30 Michael Bayer mike...@zzzcomputing.com
Christian Démolis wrote:
Thx for your answer.
MakeReleased is a method of com object windows agent (self.agent =
DispatchWithEvents('CosmoAgent.clsCCAgent', Evenement
Hi again,
Is there any way to avoid checking database structure during the
metadata.create_all declaration's phase?
It can be good to check when we are in test phase but when we are in
production and we are sure of our model, it can be good to bypass create_all
checking to database.
\teloignement VARCHAR, \n\turl VARCHAR, \n\tPRIMARY KEY
(`IdVil
le`)\n)\n\n' ()
2009/10/1 King Simon-NFHD78 simon.k...@motorola.com
-Original Message-
From: sqlalchemy@googlegroups.com
[mailto:sqlalch...@googlegroups.com] On Behalf Of Christian Démolis
Sent: 01 October 2009 10:40
Ok, i just realize that create_all is useless when database already exist.
Starting my application is 6 seconds faster now.
Thanks all
2009/10/1 limodou limo...@gmail.com
On Thu, Oct 1, 2009 at 6:25 PM, Christian Démolis
christiandemo...@gmail.com wrote:
Thx Simon,
I tried
sqlalchemy.engine.base.Engine.0x...7f50 [0, 1L]
2009-10-01 17:00:38,743 INFO sqlalchemy.engine.base.Engine.0x...7f50 COMMIT
With ORM force update 0.45368665
2009/10/1 Michael Bayer mike...@zzzcomputing.com
Michael Bayer wrote:
Christian Démolis wrote:
Hello,
I tried all the method to compare
Maybe because the database is in Tunisia and my Computer in France.
I don t use sqlite, i use MySQL.
I just did a test on internet in Tunisia, 39kbits/sec upload and
417kbits/sec
2009/10/1 Michael Bayer mike...@zzzcomputing.com
Christian Démolis wrote:
With debug mode it seems to take 0.15
i made a test
i did that without sql alchemy orm:
import MySQLdb
import time
# Establich a connection
db = MySQLdb.connection(host=192.168.45.28,
user=apm,
passwd=apm,
db=test_christian)
# Run a MySQL query from Python and get the result set
xref
Hi everybody,
I have a little problem with session.query.
I try to optimize my queries with only attributes that i need.
When we impose attribute, sqlalchemy return a rowtuple
s = session.query(IdFile, NameFile)
When we don't impose attribute, the return is the object
s = session.query(File)
Is
Ok thanks
2009/9/28 Mike Conley mconl...@gmail.com
The column is available as e.Namefile, no need to subscript with numbers.
On Mon, Sep 28, 2009 at 6:07 AM, Christian Démolis
christiandemo...@gmail.com wrote:
Hi everybody,
I have a little problem with session.query.
I try
session.query behavior without change the code of
sqlalchemy itself, please help me.
2009/9/17 Michael Bayer mike...@zzzcomputing.com
Alexandre Conrad wrote:
Christian,
2009/9/17 Christian Démolis christiandemo...@gmail.com:
Bonjour,
Tu es français je pense au vu de ton prénom.
Je
...@gmail.com
In Python, you have to pass self as first argument to all methods of a
class:
class MyQuery(sqlalchemy.orm.query.Query):
def __init__(self, *arg, **kw):
...
Alex
2009/9/18 Christian Démolis christiandemo...@gmail.com:
Hello,
Thx for the answer, thx to Alexandre
How can i force sqlalchemy to refresh an object when i did a
session.query???
Sqlalchemy seems to work with a cache, i want to deal with it.
Nota : i use sqlalchemy in non transactional mode
Session = scoped_session(sessionmaker(autocommit=True, bind=engine))
query de sqlalchemy mais je n'ai
pas réussi...
J'ai trouvé ce lien qui est intéressant mais je n'ai pas réussi à
l'exploiter :
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/PreFilteredQuery
2009/9/17 Alexandre Conrad alexandre.con...@gmail.com
2009/9/17 Christian Démolis christiandemo
in the
SQLA-schema-defintion was set to False and SQLA will probably not
examine the database's metadata in order to find out which column is
autogenerated :-)
So to make a long story short: with autoincrement=True, the 0.6 branch
and the fixed mysql dialect, everything works as expected.
Christian
On 4
I'm using MySQL and want to use a combined primary-key where the
second column is autogenerated while the first part is an assigned
value. This is how my Table-definition looks like:
table_a = Table('table_a', metadata,
Column('assigned_id', Integer(), primary_key=True,
autoincrement=False),
and the ID is then correctly set
during flush, this is not a show stopper but it seems to me, that in
the 0.6 version, the autoincrement flag does affect more than the DDL
generation.
Anyways, thanks for your help and effort!
Christian
--~--~-~--~~~---~--~~
You received
Hi Michael,
thanks for your effort, glad to hear that the issue is resolved!
On 1 Aug., 02:37, Michael Bayer mike...@zzzcomputing.com wrote:
On Jul 31, 2009, at 7:20 PM, Michael Bayer wrote:
I will investigate a way such that the dialect more intelligently
selects the primary key column
Hi,
I've ran into a problem when using a composite primary key with
auto_incremented values and nested relations. My scenario is as
follows:
I have three models A, B and C, where A has a one-to-many relation to
B and B has a one-to-many relation to C.
A has a standard primarykey consisting of
to port SA to 3.0 you have to
* wait until 2.6.1 is released. 2to3 in 2.6.0 is broken and breaks on
SA 0.5rc2
* get SA working on 2.6.1
* get SA working on 2.6.1 with the -3 warning options w/o triggering
a warning
* run 2to3 and pray ;)
Christian
86 matches
Mail list logo