Just posting this to the group for SEO equity

The docs for inserting many are all built around a table class:

conn.execute(addresses.insert(), [...    {'user_id': 1, 'email_address' : 
'j...@yahoo.com'},...    {'user_id': 1, 'email_address' : 'j...@msn.com'}


I needed to quickly create some temp tables and didn't want to create 
classes to insert data.  using a `sqlalchemy.text()` instance instead of 
`addresses.insert()` works:

    tmp_create = sqlalchemy.text("CREATE TEMPORARY TABLE 
_daily_metrics_dates ( metric_date DATE PRIMARY KEY);")
    results = dbSession.execute(tmp_create)

    tmp_insert_stmt = sqlalchemy.text("INSERT INTO _daily_metrics_dates 
VALUES (:metric_date)")
    tmp_insert_data = [{'metric_date': i} for i in dates_process_strings]
    results = dbSession.execute(tmp_insert_stmt, tmp_insert_data)

-- 
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@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to