On Wed, Aug 31, 2022, at 5:00 AM, Peter Schutt wrote:
> Hi,
> 
> I've been using 2.0 from main and notice that annotating an attribute with 
> `mapped[str | None]` raises with:
> 
> sqlalchemy.exc.ArgumentError: Could not locate SQLAlchemy Core type for 
> Python type: str | None
> 
> 
> I've been able to get it to work with a couple of mods in util.typing and 
> orm.properties and the basic tox run doesn't show any failures.
> 
> I've searched both GH issues and in the group here for that exception string 
> without result, is this worth opening an issue for?

you should be using Mapped[Optional[str]] ; that said if Mapped[Union[str, 
None]] and/or Mapped[str | None] is not being parsed then yes this is worthy of 
a bug report for 2.0.


> 
> Thanks!
> 
> 
> 
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/32e27c41-659b-4748-8ef7-3255ff13bf71n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/32e27c41-659b-4748-8ef7-3255ff13bf71n%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/5b0c86b4-3d95-44ab-b91e-df2b4736cb6d%40www.fastmail.com.

Reply via email to