3

i have a dataframe

id    value     name
1      100       sam
2      766       abc
3      234       qqq
4      435       ppp
5      345       mmm

i want to save this table into sql server database into table 'tab1'

i can do df.to_sql() but my program hangs when i'm doing this.(im using django).

is there any other way to save dataframe to sql server without using sql alchemy engine?

Shubham R
  • 7,382
  • 18
  • 53
  • 119

1 Answers1

0

You may try to avoid using SQL Alchemy, but it's not supported (deprecated) by Pandas.

Here is an excerpt from the pd.to_sql docstring:

con : SQLAlchemy engine or DBAPI2 connection (legacy mode)

Using SQLAlchemy makes it possible to use any DB supported by that

library. If a DBAPI2 object, only sqlite3 is supported.

Community
  • 1
  • 1
MaxU - stand with Ukraine
  • 205,989
  • 36
  • 386
  • 419