Skip to content
Advertisement

Tag: postgresql

How to invoke a specific shell with python?

I want to invoke a specific command shell in python to execute some scripts. For exemple, in R, I use: system2(os_shell = “C:/Program Files (x86)/pgAdmin III/1.18/pg_dump.exe”, args = “very long argument”) Thanks to this code, I can backup my Postgresql’s tables with a for loop. Problem: I didn’t find an equivalent in Python. Answer If you just want to execute

Using SQLAlchemy 1.4 classical / imperative mapping style?

I am using the clean architecture & TDD development method in my Python project. Updating from SQLAlchemy 1.3 to SQLAlchemy 1.4 broke the ability to test against an in-memory Postgres DB, and I can’t find how to fix the problem. Following DDD principles, the project uses the new imperative mapping syntax which replace classical mapping declarations. Here is a minimal

Create a new record with one2many

I want to create a new line in stock.picking, which will contain the date and the quantity: There’s no error,but the line is not created,SO I tried with There I have an error : only 2 args, 4 given. Is there another way to create a line of one2many Answer myRec.pack_lot_ids.create({‘id’: my_id,’qty’: myQty}) : this is correct you need to

How can i fetch my data from database to django template?

Whenever I run this, Exception Value: name ‘current_user’ is not defined; error is raised. I am not getting where i am doing the mistake as I m new in django programming. Please help me fetch the data Answer It looks like you will be getting that problem from showproduct(request) because you don’t define current_user in that method before calling it.

Django model saves when it shouldn’t

I’m trying to set custom validation rules on my Django models. I have the following code: Entity.py Security.py What I’m trying to do is to prevent a Security from being saved if its field entities holds more than 1 company. The entities field is a ManyToMany relationship with Entity, as it can hold multiple Asset objects but only one Company.

Can’t install own custom modules in Odoo 13

During the last two days I have been trying to install a custom module in Odoo 13. I got the same error over and over again, telling that a column didn’t exist in the model that I was creating (the variable in the class did, indeed, exist), I show the error down below. The python code of the module is

Advertisement