Re: [sqlalchemy] versioned_history example uses deprecated Column.copy() method

2021-06-17 Thread Simon King
Thanks Mike, I'll see what I can do.

Simon

On Wed, Jun 16, 2021 at 1:26 PM Mike Bayer  wrote:
>
> HI Simon -
>
> I believe that example for now should vendor its own "copy()" function that 
> does what's needed.   the function that's there is already un-doing some of 
> the work of the old copy() method in any case.  I think for history table we 
> need column name, datatype, and maybe nullable constraint.
>
> We can accept PRs for this if this is something you would be interested in, 
> although your contributions to the SQLA mailing list are already many :)
>
>
>
> On Wed, Jun 16, 2021, at 7:15 AM, Simon King wrote:
>
> Hi all,
>
> I'm updating an app from SA 1.3 to 1.4 and getting a SADeprecationWarning:
>
> The Column.copy() method is deprecated and will be removed in a
> future release. (deprecated since: 1.4)
>
> The code triggering the warning is based on the versioned_history example:
>
> https://docs.sqlalchemy.org/en/14/_modules/examples/versioned_history/history_meta.html
>
> ...and here's the offending function:
>
> def _col_copy(col):
> orig = col
> col = col.copy()
> orig.info["history_copy"] = col
> col.unique = False
> col.default = col.server_default = None
> col.autoincrement = False
> return col
>
> For the moment I've switched to calling the private _copy() method
> instead, but is there any recommendation of a better approach?
>
> (I did see the issue at
> https://github.com/sqlalchemy/sqlalchemy/issues/5953 and understand
> why the copy() method was deprecated)
>
> Thanks a lot,
>
> Simon
>
> --
> 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/CAFHwexdUVb11FTq%3DzxuzNsp-FszVHrJ8KT-yDjhyNkWqhKoJnQ%40mail.gmail.com.
>
>
> --
> 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/46661334-a2b9-4548-9003-b487b725615d%40www.fastmail.com.

-- 
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/CAFHwexf42bqjXmG9TQPd%2B0h%2BZYZAoFHnxk-ZvN2OH0MiyLRJrw%40mail.gmail.com.


Re: [sqlalchemy] versioned_history example uses deprecated Column.copy() method

2021-06-16 Thread Mike Bayer
HI Simon -

I believe that example for now should vendor its own "copy()" function that 
does what's needed.   the function that's there is already un-doing some of the 
work of the old copy() method in any case.  I think for history table we need 
column name, datatype, and maybe nullable constraint.

We can accept PRs for this if this is something you would be interested in, 
although your contributions to the SQLA mailing list are already many :)



On Wed, Jun 16, 2021, at 7:15 AM, Simon King wrote:
> Hi all,
> 
> I'm updating an app from SA 1.3 to 1.4 and getting a SADeprecationWarning:
> 
> The Column.copy() method is deprecated and will be removed in a
> future release. (deprecated since: 1.4)
> 
> The code triggering the warning is based on the versioned_history example:
> 
> https://docs.sqlalchemy.org/en/14/_modules/examples/versioned_history/history_meta.html
> 
> ...and here's the offending function:
> 
> def _col_copy(col):
> orig = col
> col = col.copy()
> orig.info["history_copy"] = col
> col.unique = False
> col.default = col.server_default = None
> col.autoincrement = False
> return col
> 
> For the moment I've switched to calling the private _copy() method
> instead, but is there any recommendation of a better approach?
> 
> (I did see the issue at
> https://github.com/sqlalchemy/sqlalchemy/issues/5953 and understand
> why the copy() method was deprecated)
> 
> Thanks a lot,
> 
> Simon
> 
> -- 
> 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/CAFHwexdUVb11FTq%3DzxuzNsp-FszVHrJ8KT-yDjhyNkWqhKoJnQ%40mail.gmail.com.
> 

-- 
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/46661334-a2b9-4548-9003-b487b725615d%40www.fastmail.com.


[sqlalchemy] versioned_history example uses deprecated Column.copy() method

2021-06-16 Thread Simon King
Hi all,

I'm updating an app from SA 1.3 to 1.4 and getting a SADeprecationWarning:

The Column.copy() method is deprecated and will be removed in a
future release. (deprecated since: 1.4)

The code triggering the warning is based on the versioned_history example:

https://docs.sqlalchemy.org/en/14/_modules/examples/versioned_history/history_meta.html

...and here's the offending function:

def _col_copy(col):
orig = col
col = col.copy()
orig.info["history_copy"] = col
col.unique = False
col.default = col.server_default = None
col.autoincrement = False
return col

For the moment I've switched to calling the private _copy() method
instead, but is there any recommendation of a better approach?

(I did see the issue at
https://github.com/sqlalchemy/sqlalchemy/issues/5953 and understand
why the copy() method was deprecated)

Thanks a lot,

Simon

-- 
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/CAFHwexdUVb11FTq%3DzxuzNsp-FszVHrJ8KT-yDjhyNkWqhKoJnQ%40mail.gmail.com.