Skip to content
Advertisement

Tag: database

Good way to “wrap” the opening and closing of a database around functions in Python?

I’ve looked at a few related questions on StackOverflow and at some documentation/guides regarding wrappers, all of which tells me “no,” but this doesn’t seem right. That said, I’m very new to programming, so 🤷‍♂️ Problem: Opening and closing a database (using python/sqlite3) requires a tedious amount of repeated code (as I understand it): So, I tried to write a

How to improve the performance of traversing a large dataset

I want to improve the logic for my task that is defined as following, the tasks is implemented in Python 3 with Django framwork: The source data is onboard to our system, the Job entity defines what involves to fully process a source, Job_instance defines the instance of Job. The requirement is as following: Given the source name, find the

SQLAlchemy SSL SYSCALL timeout coping mechanism

I’m using a combination of SQLAlchemy and Postgres. Once every while my database cluster replaces a failing node, circle of life I guess. I was under the impression that by configuring my engine in the following manner: my connections would be timing out on queries >30s, and my connections would timeout after trying for 10 seconds. What I’m noticing in

Python Database that stays with the program

So mysql works great when you log into your mysql database program on that device but what if you want to move the program to another device, the connected databases wont work… Is there anyway to have the database somehow within the python file, so that when I move it to other devices it will act the same…Thank you! Answer

How do I iterate through an entire directory and select only one class from a multi-class file in Python?

I could use some help iterating through a directory with multi-class files. Each sample contains two classes (for example, the first sample in my database is 1001, and this file includes 1001.dat and 1001.hea), and I want to iterate through my directory and access all .dat files separately from .hea files. Right now, simply iterating through the directory produces a

NoSQL alternative of sqlite in Python

I love Python’s sqlite: it is simple, it just needs one additional file to work and no additional dependencies. It is also supported by fancy ORMs, like peewee. But are there any nosql databases which can be used from python without any additional programs installed? I’m fine with additional python package, but I definitely don’t want to, for example, get

sqlalchemy foreign key could not find table

I’m making a database using sqlalchemy which consists of three classes, User, Meeting, MeetingRoom I want to create a foreign key in Meeting for the Meeting room, but for some reason it gives the following error sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column ‘meeting.mrid’ could not find table ‘meetingroom’ with which to generate a foreign key to target column ‘mrid’ When

Comparing multiple tables in Sqlite 3 using python

I am quite new to SQLITE3 as well as python. I a complete beginner in SQLite. I don’t understand much. I am right now learning as a go for my project.I am working on a project where I have one database with about 20 tables inside of it. One table is for user input and the other tables are pre-loaded

Advertisement