Questions tagged [database]
A database is any organized collection of data organized to provide efficient retrieval.
546 questions
3
votes
2
answers
168
views
Laravel Wallet Service Backend
I’ve built a backend-only wallet service using Laravel 8, and it’s fully containerized with Docker. The project handles two user roles (Players and Backoffice Agents) and provides JWT-based ...
1
vote
1
answer
66
views
Generate Serial number based on column value in sql server
I have table called cash_voucher it has some columns.
I want to generate voucher number based location id.
I mean generates voucher numbers starting from 1 for each location
For example location id is ...
6
votes
2
answers
200
views
Pydantic model <-> neomodel OGM (neo4j) <-> python dict converter
I've written a converter between pydantic models of arbitrary complexity (thus, with submodels, nulls, lists) and neomodel models (library for ...
4
votes
1
answer
180
views
Replace node type in Drupal
In Drupal 11 or greater, this code is used to change the node type of a node. How would you improve the code if at all?
...
1
vote
1
answer
140
views
Database design using Closure Table for tagging system
I created these database tables with the inspiration in NjDevPro github repository. The design uses Closure Table for implementation of hierarchical tagging system in ...
5
votes
2
answers
118
views
Accessing and editing a database in python using JSON
I am a beginner programmer and have recently started learning python. I wrote this code as a little project to understand dictionaries better and ended up having to learn to use JSON. I am self-taught,...
7
votes
4
answers
2k
views
Program for an employee database using python
In this program I'm defining functions to perform different tasks on a data record book for employees.
Here is a summary of the code:
Intro() to make the presentation of the home page.
create_record()...
5
votes
2
answers
722
views
A schema for awallet system that allows transfers between users
I am currently working on a wallet system that allows transfers of money between users. I tried creating this as a Stack Overflow question, but it was rejected. I'm not sure if this is the right ...
7
votes
3
answers
785
views
Optimal Algorithm to Append and Access Tree Data
I have been studying intermediate or more advanced data structures in Python, one of which I've decided to try out is the Tree Data Structure. I've been studying the theories as well as the ...
3
votes
1
answer
166
views
Faster Query to Track State changes in a Large Table
I have a table that tracks state changes of an entity with timestamps. The schema of the table is as follows:
entityid
userid
originalvalue
newvalue
changetime
255
101
Draft
Submitted
2023-11-28 12:10:...
1
vote
1
answer
65
views
Databases, dependency injection and static methods
I'm working on a Next.js app and looking at the best way to structure database access. With Next.js and web based apps in general, there are lots of different "server actions", aka, API ...
2
votes
1
answer
85
views
Database schema for project management app
As a side project, I'm developing a desktop app for project management, especially for students, self-employed, freelancers, etc. as a general purpose productivity tool, not from any business or ...
2
votes
1
answer
87
views
Delete duplicates from SQL database with Python and reset ID's
I tried to create a peice of code that helps me remove duplicates from my sql database and reset the ID's as well.
I am not sure that it's error proof.
...
7
votes
4
answers
815
views
JSON data format for MCQ data bank
I'm creating a data bank of MCQ (Multi Choice Questions) and their answers so that an app can be built around it. Regarding the actual storage format, I have two ideas:
An array of objects with keys (...
2
votes
0
answers
75
views
Case Study: Database design help for a small app used to coach tennis players
I have a small SQL server database and VBA program that is used to automate tasks related to tennis students, programs, practices, performances, and student testing.
I'm trying to learn db design and ...
12
votes
2
answers
1k
views
Header-only log-structured database
I'm seeking a code review for the ~2000 lines of code.
Makefile and tests are available at https://github.com/torrentg/logdb.
I would appreciate feedback on the following aspects:
Overall code ...
0
votes
1
answer
108
views
Should the SqlConnection Be a Class Field or Should I Pass It In and Out Of Functions As Needed?
I am writing a C# Database connection class and I am trying to adhere to best practices and produce clean code.
In the CreateAndOpenDatabaseConnection function ...
2
votes
1
answer
83
views
Python SQLAlchemy database model for Version Control system
This is my first time creating a non-trivial database and I was wondering what I could do better. As the title says this will be used a in toy version control system. Most of my choices feel "...
1
vote
1
answer
87
views
Insert huge data from csv file in .Net framework 4.7.2
I need to insert about 500k - 1 million data lines from a CSV file. The time of getting the reports list and insert to database by using SqlBulkCopy is very good (...
2
votes
3
answers
229
views
Inventory Management System
I'm trying to learn Django by building an inventory management system, here's my final models.py.
I'm looking for feedback!
...
-2
votes
1
answer
68
views
which layer is more fit to check data integrity: service or database? [closed]
I read a book named Effective SQL and found this interesting part.
Enforcing and maintaining business rules and relationships in
the data is part of the data model, and the responsibility belongs to ...
10
votes
1
answer
3k
views
COBOL Database Program
For a school project I've created a database program in COBOL and now that I'm finished, I have to write a report on the project.
As one aspect of the report, we have to discuss whether the product (...
5
votes
2
answers
313
views
A PHP class for the common database operations?
I'm a CS undergrad, so I don't have much experience. But while coding vanilla PHP projects, I found that I was repeating myself a lot with the CRUD operations. So overtime, I developed a single file ...
2
votes
0
answers
56
views
Barebones Qt/QML app that generates a list of dishes and then a shopping list with ingredients
I have written a simple app that generates a menu in the form of a list of recipes.
It furthermore generates a shopping list, given a menu, consisting of the (unique) ingredients in the recipes that ...
1
vote
1
answer
94
views
DB Layer of a project management CLI
I am (re)writing a project management CLI and want to put it on a solid foundation concerning the database connections and testing. My focus was to build a DB class which is easy to test and could be ...
11
votes
4
answers
2k
views
Simple Key Value Database using C
I was recently doing an assignment for a job interview, which asked to create a simple key value database with 4 command line operations:
create key value: Adds a key value pair/updates an existing ...
0
votes
1
answer
103
views
PHP login codes suggestions
Now i have a fully functional PHP codes for login and registeration i was wondering if anyone could offer improvements to the code
The code:
Config.php:
...
0
votes
1
answer
213
views
Follow up to Validation Script in PHP
So I've implemented the suggestions in Original question
And now my code looks like this:
...
2
votes
1
answer
170
views
PHP Validation script
The code below is modified slightly from the code in this previous post.
I believe the code below could be improved and more secured but i don't know how so someone please show me how an improved ...
0
votes
1
answer
305
views
SQL & PHP login method
My code is working however it seems to be using old outdated php version so less secure and I'm still new to programming so I'd be more than thankful if someone shows me how an improved updated and ...
4
votes
0
answers
67
views
API for operators and alerts
Note: The important chunks of code are pasted in the question but the larger representation of the app is available on GitHub.
Some time ago I was tasked to create a simple FastAPI app. I did manage ...
6
votes
4
answers
200
views
an algorithm that chooses the best games on steam
The code below will go through an excel spread sheet taken from kaggle, is named "SteamGames (71k games)" and the creator is "MEXWELL".
inside the ...
4
votes
1
answer
261
views
Storing icons in Room Database
I want to store some 512x512 icons for my Android app in a Room database. This is so each item in a list can have all the text data along with the image data stored in a single record.
The answers to ...
2
votes
1
answer
149
views
Script that uses an uploaded excel file to import data to the database
I wrote a script that uses an uploaded excel file to import data to the database. It checks for the image first if it can be downloaded without any error then insert the rest of the data. With ten or ...
1
vote
1
answer
152
views
Laravel Eager Loading tickets from DB
So I have the following relationship in my Model:
Events Model:
...
2
votes
1
answer
93
views
Helper functions to get, set and remove from Firefox browser storage. Also, to get, push and remove from lists stored in the database
I am making a plugin for Firefox, this is (more or less) my first time working with JavaScript. Is this a reasonable design for working with both values and lists in a database?
...
2
votes
1
answer
535
views
How to structure in handling websocket and inserting data to databse in Python
I connected to the websocket, and the data response in the callback function handle_message. I wish to insert all the data to influxdb using ...
4
votes
0
answers
81
views
Use XYZ data to create cross sectional profiles across beach terrain, using OS Grid
This might be a slightly long question, but I've recently been doing a bit of R&D on the data processing workflows within the company that I work at and it would be great to see if there are any ...
1
vote
1
answer
202
views
Efficient way to read files python - 10 folders with 100k txt files in each one
i am looking for an efficient way to read and append texts of .txt files to a dataframe. I currently have 10 folders with 100k documents each.
What i specifically need to do is:
getting the names of ...
2
votes
1
answer
102
views
Database buffer class
I designed the following DataBaseBuffer class, to be used by different threads that generate queries and need to send them to the database. It was inspired by ...
4
votes
1
answer
234
views
Postgres DB design
I need to develop a database to handle muting people in an online community. The DB needs to keep track of the currently muted people. When somebody gets unmuted, that entry gets moved to an archive ...
8
votes
2
answers
1k
views
High traffic website that shows users subscription status
I was in two minds as whether to post this question on stackoverflow or dba stackexchange but because I am asking for review, I thought of posting here.
I am new to Python and looking for feedback on ...
0
votes
1
answer
212
views
Movie library system
I want to implement a crud movie library system and also some filtering capabilities.
Since it is so big, I have added the link to the code.
https://github.com/neslihanbozer/Movie-Library.
I am aware ...
0
votes
1
answer
92
views
EF Core code-first "many-to-many-to-many" (Books with many credits with many people)
Let's say you have a book. A book can have an author, an editor, a proof reader, or several other credits. Which credits are available should be dynamic (someone might not want to have the "proof ...
3
votes
1
answer
240
views
Summing categories of financial records per month in a query
My program is working properly but I'm unconfortable with code repetition.
...
2
votes
1
answer
150
views
function to group data by parent branches
I wrote this function to take database output like from PDO's fetchAll(PDO::FETCH_ASSOC) and turn it into a tree. For small datasets it works well. However, when ...
3
votes
1
answer
465
views
Why are my read speeds so bad using sqlite?
I know very little about databases and even less about how to optimize them, but I have a problem which calls for a database so here I am...
I created a sqlite3 database using the following script:
<...
5
votes
3
answers
330
views
DB Class extending PDO w/ other useful functions
I have this DB class that extends PDO, that also has useful functions for certain tasks; I was wondering how well it's coded, and if so, what I could maybe improve on. I tried commenting in ...
2
votes
1
answer
732
views
A database trait in Rust. How can I make all these generic parameters easier to use?
I am trying to hide the implementation details of accessing a Postgres database. To do this, I want to create "database" and "transaction" traits for use in a repository struct. ...
1
vote
0
answers
70
views
UPDATE on Newspaper Bill Calculator CLI with Python (3 of 3, Database)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 1 of 3, Core: UPDATE 1 on Newspaper ...