Category : pyodbc

I hope you’re ok Im writing a django app on py3.9.1 and want to execute multiple cursors on mssql server. Here is my connection to mssql database conn = pypyodbc.connect("….") cursor = conn.cursor() cursor1 = conn.cursor() Here is my views.py @login_required(login_url="user:login") @allowed_users(allowed_permissions=["Management Perm","Boss Perm","Account Perm"]) def bills(request): keyword = request.GET.get("keyword") header = "Faturalar | Mavis ..

Read more

Hi I am trying to read a dataframe from sql server from a linux(ubuntu server). The file(gscm.ppk) has the admin keys in it I have used the following format to connect to sql server: *import urllib import pandas as pd params = urllib.parse.quote_plus("DRIVER={SQL Server Native Client 11.0};" "SERVER=dagger;" "DATABASE=test;" "UID=ubuntu;") engine = sa.create_engine("mssql+pyodbc:///?odbc_connect= {}".format(params)) df= ..

Read more

My OS is Mac Big Sur is 11.6 (20G165). I am trying to connect to Azure Server. When I try in Jupyter Notebook, which I am running via Anaconda, I get the following error: Error: (‘01000’, "[01000] [unixODBC][Driver Manager]Can’t open lib ‘ODBC Driver 17 for SQL Server’ : file not found (0) (SQLDriverConnect)") When I ..

Read more

I wanted to insert one row of data into a table while I couldn’t get rid of this: ProgrammingError: (‘The SQL contains 32 parameter markers, but 31 parameters were supplied’, ‘HY000’) Here is what I did: cursor.execute("INSERT INTO dbo.Stats (airOuts, atBats, avg, babip, baseOnBalls, " + "catchersInterference, caughtStealing, doubles, gamesPlayed, " + "groundIntoDoublePlay, groundOuts, groundOutsToAirouts, ..

Read more

I’m creating basic Flask website & API. I want to delete a record from SQL Server. I managed to work out creating & updating records. I’ve came up with the following: api2.py import secrets import pdb secret = secrets.token_urlsafe(32) from flask import Flask,render_template,url_for, request, redirect, flash import pyodbc app = Flask(__name__) app.config[‘SQLALCHEMY_TRACK_MODIFICATIONS’] = False app.config[‘SQLALCHEMY_ENGINE_OPTIONS’] ..

Read more

While trying to execute this python part of the script: df.to_sql( name=’my_table_name’, con=<my_connection_engine>, schema=’my_db’, if_exists=’replace’, index=False ) I always receive this error in the terminal where I started my script: Abort trap: 6 and this error in a pop-up window: Process: Python [14664] Path: /usr/local/Cellar/[email protected]/3.8.12/Frameworks/Python.framework/Versions/3.8/Resources/Python.app/Contents/MacOS/Python Identifier: Python Version: 3.8.12 (3.8.12) Code Type: X86-64 (Native) Parent ..

Read more