Skip to content
Advertisement

Tag: python

SQL apply where clause to an arbitrary query results

I’m working on a system where the user introduces an SQL server/db connection and a valid SQL query, which I save on my system. I’m using python+sqlalchemy+pandas to accomplish this. That query will return a table like this one, in which the only rule is that the query result must have a timestamp as DateTime field and at least another

Storing struct_time in SQL

Some code I am writing in Python takes in a date from a server in the struct_time format (with the 9 args). How can I store this date in an SQL database, and be able to read back this date as a …

How to create a leaderboard as a database

I need to create a database which is a top 5 leaderboard, however, what I tried didn’t work – it brought up many different errors (code below): Problems: The 4th line beginning “db = ” comes up with an error on the brackets. I initially thought it had to do with the fact that I am trying to make a

Python – Running a SQL in a loop based on column value

I am trying to build a SQL query that runs based on certain conditions (if a column is filled run Query 1 else Query 2 and so on) as shown below: I am trying to build something like the above but the number of fields as variable (fields like col_a and col_b) are 6 in number. Is there a way

Advertisement