postgresql

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

Why am I getting "Volumes must be mapping" error

Why am I getting "Volumes must be mapping" error Question: Trying to add Django app with a PostgreSQL db to a Docker container. When trying to run "docker-compose build", I am getting a "Volumes must be mapping" error. Not sure what I’m doing wrong as it looks like the : syntax signified a mapping. When …

Total answers: 1

Unable to import module AWS Lambda Function

Unable to import module AWS Lambda Function Question: I’m having issues running basically any lambda function on AWS as the Lambda Function tool would not be able to import the module. I tried to import the packages as layers – pretty wrong I think. (https://www.linkedin.com/pulse/add-external-python-libraries-aws-lambda-using-layers-gabe-olokun/) Then I’ve tried to import the packages as environments (from …

Total answers: 2

Connecting to PostgreSQL on Google Cloud Platform using Unix Sockets and SQLAlchemy

Connecting to PostgreSQL on Google Cloud Platform using Unix Sockets and SQLAlchemy Question: I am trying to connect to a PostgreSQL database hosted on a Google Cloud Platform instance using unix sockets and the SQLAlchemy library. My database instance is configured to accept unix socket connections. When I run my application locally, I use the …

Total answers: 1

SQLAlchemy relationship fields name constructor

SQLAlchemy relationship fields name constructor Question: I’m using SQLAlchemy 1.4 to build my database models (posgresql). I’ve stablished relationships between my models, which I follow using the different SQLAlchemy capabilities. When doing so, the fields of the related models get aliases which don’t work for me. Here’s an example of one of my models: from …

Total answers: 2

SQLAlchemy – is BigInteger Identity column possible in ORM?

SQLAlchemy – is BigInteger Identity column possible in ORM? Question: I want to create BigInteger Identity column in SQLAlchemy ORM. Documentation does not have any example of either ORM Identity or BigInteger Identity. Is this possible at all? I don’t see any parameter for Identity type that would allow specifying inner integer type How to …

Total answers: 1

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

Psycopg2 – Error during insert due to double quotes

Psycopg2 – Error during insert due to double quotes Question: I am using Python + Psycopg2 to insert an array of texts. elems column is of type text[]. a = ["A ”B” C"] cursor.execute(f""" INSERT INTO table(elems) VALUES (ARRAY{a}::text[]) """) Error: column "A ”B” C" does not exist The error above is due to the …

Total answers: 1