All Questions
Tagged with sqlalchemy python-2.7
377 questions
4
votes
0
answers
379
views
SqlAlchemy extending an existing query with additional select columns from raw sql
I'm quite new to SQLAlchemy and Python, and have to fix some bugs in a legacy environment so please bear with me..
Environment:
Python 2.7.18
Bottle: 0.12.7
SQLAlchemy: 1.3.24
MySQL: 5.7
Scenario: I ...
2
votes
1
answer
5k
views
How to use SQLAlchemy hybrid_method and hybrid_property
I have read various SO answers, read the SQLA docs, googled, and asked Google Bard. But I still have found it difficult to understand exactly how SQLAlchemy's hybrid_method and hybrid_property work. ...
0
votes
0
answers
122
views
Why SQLAlchemy ignore timezone while filtering?
Hi I have an issue with filtering datetime field in SQLAlchemy. My local time is GMT -4 and I need to get all records for today (but according to UTC time)
Here is my code:
start_time = datetime.now()
...
0
votes
0
answers
45
views
SQLAlchemy lost connection to Database when I am accessing model's property
python 2.7.10
SQLAlchemy 1.2.15
I have a model like this
class SomeClass(Base):
__tablename__ = 'some_table'
id = Column(Integer, primary_key=True)
name = Column(String(50))
if there ...
0
votes
0
answers
426
views
ImportError: cannot import name DefaultEngineStrategy
I'm trying to run a python game source I made, but everytime I do "python Login.py" I get this whole traceback:
Traceback (most recent call last):
File "Login.py", line 1, in <...
1
vote
1
answer
796
views
Get primary key of inserted row after session.execute has run in python
I have a MS SQL table called reports with following structure. I want to get the row_id of the row that was just inserted:
r_id int NOT NULL IDENTITY,
report_type int,
report_source varchar,
...
0
votes
1
answer
338
views
How to run a script when ever there is a new entry in database using SQLalchemy in python?
I am new to SQL Alchemy and need a way to run a script whenever a new entry is added to a table. I am currently using the following method to get the task done but I am sure there has to be a more ...
0
votes
1
answer
241
views
Get timestamp instead of datetime object, sqlalchemy python 2.7
Is there any way to query date and get timestamp instead of datetime.datetime object in sqlalchemy using python 2.7?
0
votes
0
answers
398
views
CKAN-Datapusher HTTP500 error due to "Error - <class 'sqlalchemy.exc.TimeoutError'>: QueuePool size 5 overflow 10 reached, connection timedout" out"
I'm using CKAN v2.7.2(docker). And getting "Error - <class 'sqlalchemy.exc.TimeoutError'>: QueuePool limit of size 5 overflow 10 reached, connection timed out, timeout 30" error due to ...
0
votes
0
answers
537
views
I get ImportError: No module named pyodbc when I try to connect to the sybase database
I am trying to connect to the sybase database using sqlalchemy. I am doing my development in Linux environment. I am also using python 2.7
I have the following code in which I am just trying to ...
3
votes
1
answer
1k
views
How to increment multiple rows using SqlAlchemy
How to update multiple records with incrementing some field (in my case id)?
I missed one record and the whole table shifted.
How to do that in one transaction or one query? Or what is the fastest way ...
0
votes
2
answers
4k
views
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: mytable
I build a dashboard to track my orders, revenue etc. I created a database that includes all related data. I download a Flask dashboard template and editing it. I can collect all my order data and use ...
1
vote
0
answers
435
views
SQLAlchemy keeps the DB connection open
I have an issue with in my Flask app concerning SQLAlchemy and MySQL.
In one of my file: connection.py I have a function that creates a DB connection and set it as a global variable:
db = None
def ...
0
votes
1
answer
630
views
Print compiled sqlalchemy query
Is there a way I can print a query created by sqlalchemy
emp = session.query(Employee).filter(*empfilters).order_by(Employee.Name).all()
I've tried doing str(emp), emp.statement.compile(dialect=...
0
votes
2
answers
1k
views
Python - Postgres query using sqlalchemy returns "Empty Dataframe"
I try to query some data from a postgres database and add the results into an excel with the below Python code (I am connecting to the server through ssh tunnel and connecting to database using ...