Skip to main content

All Questions

3 votes
0 answers
926 views

Delete multiple records with composite key in sqlalchemy [duplicate]

I have a table with a composite primary key. ReportsTable: id1,id2,data,... I want to delete multiple rows based on the composite key list. Eg. [(1,0),(1,1),(2,0),(3,0),(3,1),(3,2),(3,3)] How to ...
brainless's user avatar
  • 5,829
0 votes
0 answers
193 views

sql alchemy Update resultset of raw query

Am new to Sql Alchemy. I have a raw sql which i need to execute by passing bind parameters. Resulting rows from the query, i need to update a particular column value. How do i do this in the efficient ...
RK3's user avatar
  • 1,269
2 votes
1 answer
5k views

Sqlalchemy convert epoch time to date in group by

I am using Sqlalchemy as ORM for PSQL db. My timestamps are stores as epoch times in my database eg, 1525868337991. (in milli sec) I am writing a query to get count of employees on a particular date(...
rishabh-lok's user avatar
0 votes
1 answer
347 views

sql-alchemy open session from an active session

I'm new to sql-alchemy and trying to understand what will happen in the following case: let's assume that I have the following code: with db.mysession() as session: first_obj = session.query(db....
Maxim Dunavicher's user avatar
0 votes
0 answers
875 views

SQL Alchemy ForeignKeyConstraint with duplicate source column

im coding on a migrationtool for bringing DDL and raw-data from a DB2 database to a mssql database. When i will reflect my database by SQL Alchemy ORM, i get the fellowing error: File "C:\Python27\...
Jassin Rdrgo's user avatar
6 votes
1 answer
6k views

SQL Alchemy Check Connection

I created the below method to connect to SQL Server using SQL Alchemy and Pyodbc. def getDBEngine(server, database): Params = urllib.quote_plus("DRIVER={SQL Server};SERVER="+server+";DATABASE="+...
Pandas's user avatar
  • 75
1 vote
1 answer
473 views

Is a Python DBAPI cursor the same as a SQL cursor? If so how to improve the performance? What should be the alternative approach?

We have a really big data querying process. As of now we are fetching the data using raw sql queries and we are executing them in using a python db api cursor. import psycopg2 conn = psycopg2....
Bhargav's user avatar
  • 494
2 votes
0 answers
168 views

SQLAlchemy commit primaryjoin column

I Have two tables "CashDoc" and "Entry". class Entry(Base): __tablename__ = 'journal_entries' id = Column(Integer, primary_key=True) credit = Column('credit', String) debit = Column('...
Анатолий Никифоров's user avatar
1 vote
1 answer
794 views

How do I handle database columns with reserved characters in SQLAlchemy ORM?

I'm somewhat new to SQLAlchemy ORM, and I'm trying to select and then store data from a column within a view that has a forward slash in the name of the column. The databases are mapped using the ...
alexk's user avatar
  • 1,584
2 votes
1 answer
66 views

What is pythonic way with SQLAchemy to update dataset?

I want to implement a simple flow in my utils: Get rs=Query() from DB Iterate over rs and send request requests.get(rs['http']) Parse response and get logo_url value Update rs dataset import requests ...
SpanishBoy's user avatar
  • 2,225
0 votes
1 answer
45 views

Python function will cycle through but error on the final iteration

On the following Python function I am using Python 2.7.6 and SQLAlchemy as the ORM. I am stumped as to why I keep getting the following error even though the function cycles through. def ...
David A Negrete's user avatar
0 votes
1 answer
535 views

sqlalchemy pyramid query keyerror

I am working on a project that loads local data onto a local server using SQLAlchemy and a pyramid framework. The following describes the setup: -The local data are divided in multiple CSV files -A ...
Roman's user avatar
  • 9,471
1 vote
1 answer
290 views

many-to-many table and initialize fields

I want to add some fields into many-to-many table and when im using something like this: test_server = FileServer('192.168.1.1', 80, 'online') session.add(test_server) session.commit() test_file = ...
Relrin's user avatar
  • 790
0 votes
1 answer
221 views

Getting results from query with alchimia library

Im trying to use alchimia for get asynchronous API for DB. Trying to make a simple request to DB, like that: def authorization(self, data): """ Checking user with DB ""...
Relrin's user avatar
  • 790
15 votes
2 answers
18k views

Is possible to mapping view with class using mapper in SqlAlchemy?

As Mentioned here I created View. Is following possible to create view class for using with session? v = Table('viewname', metadata, autoload=True) class ViewName(object): def __init__(self, ...
Syed Habib M's user avatar
  • 1,827

15 30 50 per page