sql-server

Sql Server SET TRANSACTION ISOLATION LEVEL READ COMMITTED does not appear to work with pyodbc

Sql Server SET TRANSACTION ISOLATION LEVEL READ COMMITTED does not appear to work with pyodbc Question: Short Summary I am running multiple sql queries (each committed separately) within one session via pyodbc. In a few queries we call SET TRANSACTION ISOLATION LEVEL SNAPSHOT;, begin a transaction, do some work, commit the transaction and then call …

Total answers: 2

SQLAlchemy 1.4 tutorial code "'Connection' object has no attribute 'commit'" error or does not commit changes

SQLAlchemy 1.4 tutorial code "'Connection' object has no attribute 'commit'" error or does not commit changes Question: Here is some custom code I wrote that I think might be problematic for this particular use case. class SQLServerConnection: def __init__(self, database): … self.connection_string = "DRIVER=" + str(self.driver) + ";" + "SERVER=" + str(self.server) + ";" + …

Total answers: 3

How to avoid loss precision for datetime type in sqlalchemy?

How to avoid loss precision for datetime type in sqlalchemy? Question: I’m a newbie in python and I got this issue. I have a column in my database which has type is datetime and precision is 23 (Ex: 2022-08-22 11:18:00.000) When I retrive data with sqlalchemy, it seem convert to python datetime (2022-08-22 11:18:00). How …

Total answers: 1

Selecting a column with a slash in SQL Alchemy

Selecting a column with a slash in SQL Alchemy Question: I need to select some columns from a table with SQL Alchemy. Everything works fine except selecting the one column with ‘/’ in the name. My query looks like: query = select([func.sum(Table.c.ColumnName), func.sum(Table.c.Column/Name), ]) Obviously the issue comes from the second line with the column …

Total answers: 1

Why Can't I Add a Column using Alembic Because it isn't in the Table?

Why Can't I Add a Column using Alembic Because it isn't in the Table? Question: So I’m trying to use alembic to add a column to my table. Here’s my class defining the table with the new line in bold: class Account(db.Model): id = db.Column(db.Integer, index=True, primary_key=True) account_number = db.Column(db.String(10), index=True) primary_member_fk = db.Column(db.Integer) first_deposit …

Total answers: 1

How to connect to MS-SQL server without database name using pyodbc python?

How to connect to MS-SQL server without database name using pyodbc python? Question: I need to connect to the ms-sql database and then create a new database there using python script. I have the user credentials for the login. So how to create the connection to the ms-sql server using python. Asked By: Arun Yadav …

Total answers: 2

Task scheduler shows python script shows as running but not working

Task scheduler shows python script shows as running but not working Question: I’ve been trying to run a lengthy Python script in the task scheduler in order to be able to run it for a long periods of time. I’ve tried using bat files, inserting just the path to the actual python file, python.exe files, …

Total answers: 2

Python and Win32com module issue with querying SQL Database rows

Python and Win32com module issue with querying SQL Database rows Question: My goal is to display SQL queries via the Python console using the Win32com module. I am able to use a comobject to access and successfully display the fields of a SQL query however when i try to display rows i am falling into …

Total answers: 2