Skip to content
Advertisement

Tag: python

Two dependent conditions in exclude DJANGO

I want to check whether the current user already has the same movie id in his personal list or not. If he has it then I want to exclude that movie from my trending list. I want it to be something like this. views.py models.py Answer You can .exclude(…) with: If you specified a related_query_name=… [Django-doc] or a related_name=… [Django-doc],

Python Cx_Oracle select query binding a tupled list with WHERE IN clause

Due to Oracle’s 1000 “IN” clause limit, one workaround is to use list tuples. I am attempting this in Python but cant seem to bind the list tuple correctly. My code: This gives me error: cx_Oracle.NotSupportedError: Python value of type tuple not supported. Whats the possible workaround for this error? Thanks Answer Your python is generating the following query string…

How to use variable column name in filter in Django ORM?

I have two tables BloodBank(id, name, phone, address) and BloodStock(id, a_pos, b_pos, a_neg, b_neg, bloodbank_id). I want to fetch all the columns from two tables where the variable column name (say bloodgroup) which have values like a_pos or a_neg… like that and their value should be greater than 0. How can I write ORM for the same? SQL query is

Add Column in a table [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about programming within the scope defined in the help center. Closed last year. Improve this question Am trying to add a column in the table salesperson. And it is showing error. Pls help. I am using the latest

Python/SQL/pydobc: Get result of if operation for counter?

I’m running the following code to add emails to a database table if they do not already exist. I’d like to be able to count the emails that are added and the ones that already existed. I’ve tried checking the cursor.description after each loop, but it returns None whether the item existed or not. Is there a way to do

Advertisement