Taragolis commented on PR #38362:
URL: https://github.com/apache/airflow/pull/38362#issuecomment-2015337750

   > LGTM. But I think we need more confirmation that it should be safe to 
change the default
   
   Note this not a change in default. `values_plus_batch` = `values` in SA 1.4 
(at least it what happen if compare 1.3 and 1.4 doc and commit to SA), but 
`values` is not documented in 1.4 and do not work with SA 2.0, because it was 
removed.
   
   So behavior should remaining the same in 1.4.
   
   Some snippet for local validation
   
   ```python
   from sqlalchemy import create_engine
   from importlib.metadata import version
   
   SQL_ALCHEMY_CONN = 
"postgresql+psycopg2://postgres:airflow@127.0.0.1:25433/airflow"
   args = {
       "current": {
           "executemany_mode": "values",
           "executemany_values_page_size": 10000,
           "executemany_batch_page_size": 2000,
       },
       "proposed": {
           "executemany_mode": "values_plus_batch",
           "executemany_values_page_size": 10000,
           "executemany_batch_page_size": 2000,
       },
       "not-set": {}
   }
   
   print(f"SQLAlchemy version: {version('sqlalchemy')}")
   for name, pg_default_args in args.items():
       print(f" {name} ".center(72, "="))
       try:
           engine = create_engine(SQL_ALCHEMY_CONN, **pg_default_args, 
future=True)
       except Exception as e:
           print(f"Input: {pg_default_args.get('executemany_mode')!r}, error: 
{e}")
       else:
           print(f"Input: {pg_default_args.get('executemany_mode')!r}, output: 
{engine.dialect.executemany_mode}")
           engine.dispose()
   
   ```
   
   Outputs on different versions
   
   ```cosole
   SQLAlchemy version: 1.4.52
   =============================== current ================================
   Input: 'values', output: symbol('executemany_values_plus_batch')
   =============================== proposed ===============================
   Input: 'values_plus_batch', output: symbol('executemany_values_plus_batch')
   =============================== not-set ================================
   Input: None, output: symbol('executemany_values')
   
   SQLAlchemy version: 1.4.0
   =============================== current ================================
   Input: 'values', output: symbol('executemany_values_plus_batch')
   =============================== proposed ===============================
   Input: 'values_plus_batch', output: symbol('executemany_values_plus_batch')
   =============================== not-set ================================
   Input: None, output: symbol('executemany_values')
   
   SQLAlchemy version: 2.0.28
   =============================== current ================================
   Input: 'values', error: Invalid value for 'executemany_mode': 'values'
   =============================== proposed ===============================
   Input: 'values_plus_batch', error: Invalid argument(s) 
'executemany_values_page_size' sent to create_engine(), using configuration 
PGDialect_psycopg2/QueuePool/Engine.  Please check that the keyword arguments 
are appropriate for this combination of components.
   =============================== not-set ================================
   Input: None, output: symbol('EXECUTEMANY_VALUES')
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to