issue https://github.com/sqlalchemy/sqlalchemy/issues/6963 is added to deal 
with possibly multiple failure modes in this case.

On Tue, Aug 31, 2021, at 10:24 AM, Mike Bayer wrote:
> Hi -
> 
> Your test case is omitting a critical detail which we would assume is you are 
> using the "implicit_returning=False" flag on your create_engine().    dont 
> use this flag as it serves no useful purpose and that will fix your issue 
> here, we will be deprecating and removing this flag.
> 
> will try to fix the immediate issue if possible.
> 
> 
> On Tue, Aug 31, 2021, at 3:29 AM, Francesca L wrote:
>> Hi group, 
>> 
>> I am tring to migrate from version *1.3.24* to *1.4.23* of SqlAlchemy, using 
>> *PostgreSQL 10*.
>> 
>> I found that the following code example works with 1.3, but triggers a 
>> traceback with 1.4.
>> 
>> import sqlalchemy
>> 
>> session = ...
>> metadata = sqlalchemy.MetaData()
>> s_items = sqlalchemy.Sequence('s_items', start=1, increment=1, 
>> metadata=metadata)
>> t_items = sqlalchemy.Table('t_items', metadata,
>>     sqlalchemy.Column('id', sqlalchemy.Integer, s_items, primary_key = True),
>> )
>> metadata.drop_all(bind=session.bind)
>> metadata.create_all(bind=session.bind)
>> 
>> class Item(object):
>>     pass
>> 
>> sqlalchemy.orm.mapper(Item, t_items)
>> 
>> item1 = Item()
>> item2 = Item()
>> session.add_all([item1, item2])
>> session.flush()
>> 
>> This code, with 1.4 only, triggers the following traceback:
>> 
>> Traceback (most recent call last):
>>   File "C:\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 1672, 
>> in _execute_context
>>     dialect, self, conn, execution_options, *args, **kw
>>   File "C:\Python36\lib\site-packages\sqlalchemy\engine\default.py", line 
>> 999, in _init_compiled
>>     self._process_executemany_defaults()
>>   File "C:\Python36\lib\site-packages\sqlalchemy\engine\default.py", line 
>> 1838, in _process_executemany_defaults
>>     if c.default and c.default.is_scalar:
>> AttributeError: 'Sequence' object has no attribute 'is_scalar'
>> 
>> The only way I found to work around this with version 1.4, is to call *flush 
>> *after each single *add*:
>> 
>> item1 = Item()
>> session.add(item1)
>> session.flush()
>> item2 = Item()
>> session.add(item2)
>> session.flush()
>> 
>> But this seems weird, to me. 
>> Am I doing anything wrong?
>> Thank you very much for any suggestion.
>> 
>> Francesca Leon 
>> 
>> 
>> -- 
>> SQLAlchemy - 
>> The Python SQL Toolkit and Object Relational Mapper
>>  
>> http://www.sqlalchemy.org/
>>  
>> To post example code, please provide an MCVE: Minimal, Complete, and 
>> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
>> description.
>> --- 
>> 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 view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sqlalchemy/c049bcf1-ff1c-4d78-b38f-6f2dba1a87e1n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/sqlalchemy/c049bcf1-ff1c-4d78-b38f-6f2dba1a87e1n%40googlegroups.com?utm_medium=email&utm_source=footer>.
> 
> 
> 
> -- 
> SQLAlchemy - 
> The Python SQL Toolkit and Object Relational Mapper
>  
> http://www.sqlalchemy.org/
>  
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
> --- 
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/0d33f6cb-fb89-4272-a301-83233df6c8b2%40www.fastmail.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/0d33f6cb-fb89-4272-a301-83233df6c8b2%40www.fastmail.com?utm_medium=email&utm_source=footer>.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/540a63a6-cad2-4b33-8a53-4844867c4cc1%40www.fastmail.com.

Reply via email to