pyodbc

Install unixodbc-dev for a Flask web app on Azure App Service

情到浓时终转凉″ 提交于 2019-12-24 18:40:30
问题 I am trying to deploy Flask web app on the Azure App Service. This app is using pyodbc to connect to mssql; however, when I deploy the app I get this error ImportError: libodbc.so.2: cannot open shared object file: No such file or directory I got to know that I can solve this issue by installing unixodbc/unixodbc-dev with the following line: sudo apt-get install unixodbc-dev I tried to do this manually by accessing the SSH of Kudu; however, the issue still persists. I am using a local

pyodbc not working on RedHat 5.4. Trying to connect to ms-sql database server using unixODBC and FreeTDS?

亡梦爱人 提交于 2019-12-24 16:26:43
问题 I am facing issue while trying to access ms-sql database using pyobdc. Here is the System config: Python 2.7.11 Pyodbc 3.0.7 RedHat 5.4 (Tikanga) 32 Bit system Microsoft SQL Server 2012 (Database server) unixODBC 2.3.0 $ tsql -C output : Compile-time settings (established with the "configure" script) Version: freetds v0.91 freetds.conf directory: /etc MS db-lib source compatibility: yes Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 5.0 iODBC: no unixodbc:

Use UPDATE in a loop

百般思念 提交于 2019-12-24 16:24:36
问题 When I execute the following code: for acc_row in cursor.execute("select * from tabela1"): cursor.execute("UPDATE table_name SET column_name=? where column_name=?", ('some_value','some_value')) I receive the following error referencing the line containing the for loop: ProgrammingError: No results. Previous SQL was not a query The for loop works fine without the update statement, and vice versa Software: Python 2.7 Windows pyodbc 3.0.7 AccessDatabaseEngine for MS Access 2010 回答1: You are

itter from some odbc connection to pandas table with out a csv

岁酱吖の 提交于 2019-12-24 15:33:09
问题 I have some base info in a pandas DataFrame. I need to join it with some reference tables that I have access via a pyodbc connection. Is there any way to get the sql result set into a pandas DataFrame without writing the result set out to a csv first? It just seems like a waste to have this extra step out to csv and into a DataFrame. 回答1: I've gotten pyodbc to work with my SQL Server instance, then, with some help from this thread, I got the sql return to load a dataframe. I already setup a

Python Pandas to_csv Output Returns Single Character for String/Object Values

£可爱£侵袭症+ 提交于 2019-12-24 11:37:50
问题 I'm attempting to output the result into a pandas data frame. When I print the data frame, the object values appear correct, but when I use the to_csv function on the data frame, my csv output has only the first character for every string/object value. df = pandas.DataFrame({'a':[u'u\x00s\x00']}) df.to_csv('test.csv') I've also tried the following addition to the to_csv function: df.to_csv('test_encoded.csv', encoding= 'utf-8') But am getting the same results: >>> print df a 0 us (output in

Django 2.0+ and SQL Server interface question

≯℡__Kan透↙ 提交于 2019-12-24 11:08:26
问题 Why is it necessary to have both Pyodbc and django-pyodbc-azure installed to interface with recent SQL Server versions with Django? Why can't django just use Pyodbc out of the box? I'm having trouble getting Sql Server to play nice with python 3.4.5, Django 2.1, pyodbc 4.0+, and Django-Pyodbc-azure 2.0.8. I keep getting a segmentation fault thrown when attempting to query certain models that I reflected with inspectdb. The version of linux that I am using is openSUSE 42.1 The version of Sql

BULK INSERT into SQL Server table using pyodbc: cannot find file

孤人 提交于 2019-12-24 08:22:38
问题 I know this kind of question has been asked before but still couldn't find the answer I'm looking for. I'm doing bulk insert of the csv file into the SQL Server table but I am getting error shown below: My Code: df_output.to_csv('new_file_name.csv', sep=',', encoding='utf-8') conn = pyodbc.connect(r'DRIVER={SQL Server}; PORT=1433; SERVER=Dev02; DATABASE=db;UID='';PWD='';') curr = conn.cursor() print("Inserting!") curr.execute("""BULK INSERT STG_CONTACTABILITY_SCORE FROM 'C:\\Users\\kdalal\

Connecting to MySQL using pydobc

ε祈祈猫儿з 提交于 2019-12-24 08:13:30
问题 We need to connect to MySQL from Python, using pyodbc. After installing pyodbc, this is what we get: pyodbc.connect("DRIVER={MySQL};SERVER=localhost;DATABASE=HAGC;USER=user;PASSWORD=pass;OPTION=3;") Traceback (most recent call last): File "<stdin>", line 1, in <module> pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/lib64/libmyodbc5.so' : file not found (0) (SQLDriverConnect)") So I tried two things: 1- edit /etc/odbcinst.ini. That did not work. 2- create a

What are the advantages and disadvantages of using pypyodbc, pymssql, and pyodbc? [closed]

久未见 提交于 2019-12-24 05:14:15
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 4 months ago . I know that Pypyodbc is the newer version of Pyodbc. A question before asked about the comparison between these two but I want to add Pymssql into the mix. 回答1: As of December 2019: pyodbc is under active development, is officially supported by Microsoft (when using the

Python - Pyodbc Connection error

六月ゝ 毕业季﹏ 提交于 2019-12-24 05:07:05
问题 I am trying to connect to the SQL Server database using Python3.4 This is the code that works for me cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER=DESKTOP-GDM2HQ17\SQLEXPRESS;DATABASE=pyconnect;Trusted_Connection=yes') and I login into my Management studio - database using Windows connection. Here is the code, which is not working for me : cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};SERVER=DESKTOP-GDM2HQ17\SQLEXPRESS;DATABASE=pyconnect;UID=DESKTOP