sql

How to use a Postgreql Boolean value as a parameter in a python if statement?

How to use a Postgreql Boolean value as a parameter in a python if statement? Question: I have been trying to create a python function that will use a select statement that will return a single Boolean value from my postgres database and then use it in a python if statement. I have found out …

Total answers: 1

Python to SQL using strip

Python to SQL using strip Question: gday I would like to know how to convert the following python script to sql and with its source file being a txt file Data = [ r[0: 2].strip(), # Column 1 r[2: 14].strip() # Column 2 ] I’ve loaded the txt file into a table with a single …

Total answers: 1

Python datetime.date.today() not formatting inside sqllite3

Python datetime.date.today() not formatting inside sqllite3 Question: In my database query which is executed with the sqlite3 module I insert a new row of data which includes a date field. The problem is when getting todays date with datetime.date.today().strftime(‘%Y-%m-%d’) which outputs ‘2023-02-06’ (expected output), it changes inside the database to ‘2015’. Why does this happen? …

Total answers: 1

Python in Execute Process Task

Python in Execute Process Task Question: I have written a python code, then ran it through SSIS in the Execute Process Task, because I want to schedule it with table refresh dependency(which is not possible through windows scheduler or Alteryx). The code reads and writes to SQL management studio to translate via Google API (pip …

Total answers: 2

Pass values from python code to a postgresql query

Pass values from python code to a postgresql query Question: I read an excel-file, put the data in a pandas dataframe and then i wanna put the data in a postgresql database. Problem is getting the pandas-value to the postgresql-database. For putting the data into psql-database i use: cursor.execute(‘CALL controldubbel2(%s, %s, %s, %s, %s, %s, …

Total answers: 1

Python passing decimal values with comma's to a postgresql function

Python passing decimal values with comma's to a postgresql function Question: I have a postgresql function which needs decimal/numeric values as variables. The variables come from a database which holds decimal values with comma’s as delimeters. Problem i have is that de postgresql-function now reads these comma’s as a delimeter for the different variables. This …

Total answers: 1

How to group and filter a dataframe in PySpark

How to group and filter a dataframe in PySpark Question: Attached is my dataframe and I’m trying to find a way in pySpark to filter Link Name for which none of the Supports are with Status ‘In’. For eg. The expected output should be only Link3 as none of the supports associated to it are …

Total answers: 1