Re: [sqlalchemy] Deleting rows from a table where row elements are found in a pandas.DataFrame

2018-01-04 Thread Jevgenij Kusakovskij
I sorted this problem out and, as you predicted, it turned out to be layers upon layers of problems. If you do not mind having a quick look at how I resolved this, I would really appreciate some feedback and a second opinion... I actually missed the main problem initially. It had to do with the

Re: [sqlalchemy] Deleting rows from a table where row elements are found in a pandas.DataFrame

2018-01-03 Thread Jevgenij Kusakovskij
It is a list of dictionaries indeed. I will investigate this issue tomorrow. If something useful comes out or if I have any more questions, I will write back here. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please prov

Re: [sqlalchemy] Deleting rows from a table where row elements are found in a pandas.DataFrame

2018-01-03 Thread Jevgenij Kusakovskij
Thank you for such a quick response! Tried your suggestions, but still getting the same error. And could it be caused by some data in the DataFrame being 'odd'? E.g. Timestamp('2012-05-22 00:00:00') assigned to col2. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://

[sqlalchemy] Deleting rows from a table where row elements are found in a pandas.DataFrame

2018-01-03 Thread Jevgenij Kusakovskij
I feel bad bugging you with questions everyday, but it seems that I get them answered here... Hope I am not abusing your hospitality. I would like to delete multiple rows from a table on a MS SQL Server. The rows to be deleted are given in a `pandas.DataFrame` object and there can be thousands

Re: [sqlalchemy] Speeding up inserts of lines with fast_executemany option of pyODBC

2018-01-02 Thread Jevgenij Kusakovskij
Great! Thanks a lot for all your help! On Tuesday, January 2, 2018 at 6:48:35 PM UTC+2, Mike Bayer wrote: > > On Tue, Jan 2, 2018 at 11:24 AM, Jevgenij Kusakovskij > wrote: > > I see... I should have warned that I am new to Python and that questions > of > > this c

Re: [sqlalchemy] Speeding up inserts of lines with fast_executemany option of pyODBC

2018-01-02 Thread Jevgenij Kusakovskij
> > if key is present, you get key back, assuming it's True you get True > key is not present, you get default back, e.g. False > > > > > > > > On Tuesday, January 2, 2018 at 4:27:53 PM UTC+2, Mike Bayer wrote: > >> > >> On

Re: [sqlalchemy] Speeding up inserts of lines with fast_executemany option of pyODBC

2018-01-02 Thread Jevgenij Kusakovskij
ecutemany = True Maybe I am missing something, but should it be: if context.execution_options.get('pyodbc_fast_execute', True): cursor.fast_executemany = True On Tuesday, January 2, 2018 at 4:27:53 PM UTC+2, Mike Bayer wrote: > > On Tue, Jan 2, 2018 at 6:46 AM, Je

[sqlalchemy] Speeding up inserts of lines with fast_executemany option of pyODBC

2018-01-02 Thread Jevgenij Kusakovskij
I would like to send a large pandas.DataFrame to a remote server running MS SQL. I am using pandas-0.20.3, pyODBC-4.0.21 and sqlalchemy-1.1.13. My first attempt of tackling this problem can be reduced to following code: import sqlalchemy as sa engine = sa.create_engine("mssql+pyodbc:///?od