Questions tagged [database]

A database is any organized collection of data organized to provide efficient retrieval.

96 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
1k views

Generic Unit of Work implementation

I am implementing the unit of work pattern to be used in the logic layer of my application. The goal is to abstract away the tasks of managing transactions / connections. My implementation relies ...
4
votes
0answers
239 views

Script to make file hashes and track changes

I'm fairly new to python and decided to build something useful (I believe). So I made this script to track changes in user's files with DB with ability to "Accept changes", so end-user might track ...
4
votes
0answers
108 views

Heterogenous tree in the application domain: How do I represent them?

The Domain I have three types of items in my domain: ItemA, ItemB, ItemC. (I can't use their real names.) ItemA has one attribute: thing_id. ItemB has 6 attributes: thing_id, name, description, ...
3
votes
0answers
62 views

How can I filter and sort LinkedList faster and more effective?I have list of orders that should be processed

I have method that fetches all orders from Database and filtering, sorting that data(I know better to do It by specific query to Database but I dont know how). I have Order entity that has following <...
3
votes
1answer
94 views

All core MediaWiki upgrade script (round 2)

The following script upgrades an existing, all core (no add ons) MediaWiki install. I run it with set -x for debugging (I avoid ...
3
votes
0answers
116 views

PowerShell Script to get data from Third Party API and insert into database

I have created a PowerShell script that will call a REST API and then for each node returned, add the data into a database table. This particular endpoint only returns ~600 records worth of data, ...
3
votes
0answers
20 views

Organizing and accessing data in xml database - VB.Net

So I made an XML database for my music player where I store songs data (title,artist,album,genre,year) the code for generating the database is working but slow as heck, the code works as following ...
3
votes
0answers
52 views

SQL database implementation - statement execution

This is another class from my implementation of SQL in C#. It handles the execution of SQL statements, with the core method looking like this: ...
3
votes
0answers
400 views

Product inventory database with attributes and variants

I have design a model for product apps. This is the first time I am trying to create a product's database schema and then model it in Django. My code handles the following: A product type can have ...
3
votes
0answers
35 views

Connect to a database with Diesel

New to Rust and would like some clarification on idiomatic and readable use of Result and Error types. Here I'm simply connecting to a database using Diesel. In my opinion, the use of match and Boxing ...
3
votes
0answers
1k views

Red-black tree in Rust

Although I have done a few toy projects in Rust, I haven't really done anything related to tedious memory management tasks. So I set out to create a database with the help of the project 500 lines or ...
3
votes
0answers
5k views

Django 'Like' functionality for a post

I am implementing a like button for posts (Using a clustom Like model and the pre-defined User model from django.contrib.auth). Would appreciate hearing how I can improve this code. Also, I am ...
3
votes
0answers
398 views

MySQL Schema for Tag System Works, But Can It Be Better?

I'm working on system that tags images. I'm going to use the xxHash (lz4) for hashing images. With hashes of size 64 bits, it looks like I won't have a 50% chance of a collision until ~4 billion ...
3
votes
0answers
3k views

A simple User class

...
3
votes
0answers
130 views

Implementing a long-running entity lock

Requirement I have an entity named ImportData which can be processed once in order to extract data from a file fed to the application. I need to make sure that, in ...
3
votes
0answers
1k views

Combining pagination and non query grouping in Slick 3.0

I have the following tables: val postTable = TableQuery[Posts] val postTagTable = TableQuery[PostTags] val tagTable = TableQuery[Tags] One post can have multiple ...
3
votes
0answers
350 views

C++ PostgreSQL database driver wrapper

I am writing my own wrapper for PostgreSQL (but it can be used for other engines too). I am using this desgin: ...
3
votes
0answers
124 views

Phoenix Ecto schema for internal mailbox

I am building an application messaging system. I am planning on using channels for real-time notifications but I was wondering if this schema makes sense. I am looking for any constructive criticism ...
3
votes
0answers
113 views

Mangling MP3 collections

I'm writing a little tool for mangling MP3 collections and, as a challenge, I decided to write in in Hy, a dialect of Python that uses Lisp syntax. Like every good developer, I wrote out my list of ...
3
votes
0answers
70 views

Abstract Key Value Store

I'm attempting to define an abstract interface for a key value store. Some requirements: Once a key has been written it should never be overwritten (although it may be deleted Transactions with ...
2
votes
0answers
21 views

Compute damages and savings for motor insurance claims

I am working on some claims data, where I have features such as The descriptions of the columns are: (A) the year of claim, (B) who's the insuring company (C) whether the vehicle is driven, (D) ...
2
votes
0answers
28 views

Erlang: Seeking advice on BEST practices with ETS table manager

I wrote a some what "simple" module to retain ETS tables should the owner crash. I think it's small enough for review; big enough to make enough mistakes. Honestly I'm a hobbyist programmer ...
2
votes
0answers
170 views

Providing different __table_args__ to SQLAlchemy mapped class depending on backend DBMS

I need to set different __table_args__ for the mapped class depending on the backend DBMS, e.g. mssql and ...
2
votes
0answers
64 views

Using R to Dynamically Query Database Using SQL Template

Purpose of Code The purpose of the main function (get_player_penalties()) is to: Generate simple SQL statements from user input and a template Query a database ...
2
votes
0answers
31 views

Handling failures in DB transactions

This code is meant to retry the db operation when a DB connection breaks: OperationalError. A transaction can fail for example when a db is being restarted and a commit fails. Or when a network error ...
2
votes
0answers
45 views

Sharing model for different ORM's

I am building a MySQL to Realmdb converter app. I use Entity Framework to deal with MySQL, so below is the code of one of my model classes. I don't want to have multiple classes representing the same ...
2
votes
0answers
29 views

Gathering data using sqlalchemy from database and making it available using simplified namedtuple object in an iterable class

I wrote the below code today: ...
2
votes
0answers
13k views

MySQL database schema for e-commerce website

I'm making an e-commerce site, using MySQL for storing data. ...
2
votes
0answers
34 views

Many to many (n to m) relationship without insert duplication php

I managed to make a many to many relationship work correctly using mysql, doctrine 2 and symfony 3.4. When a new element A that contains 0 to m element Bs is inserted, the B elements that already ...
2
votes
0answers
194 views

Django social network application - database schema

I am writing a simple social media application in Django. I would like to know whether the following model structure is correct, or how can I improve the schema to get better performance. Do I need to ...
2
votes
0answers
605 views

Query your MySQL server for table size by row count and physical size by database

After writing a similar SQL procedure to check my table sizes several times, I wrote this stored procedure to check my MySQL database's table size. It will show you the table sizes and row count ...
2
votes
0answers
177 views

EF mapping complex type to JSON in DB

I am trying to map a complex type to Json and store the info as Json in the DB using EF6 Code First. Here's what I have for now: The complex type ...
2
votes
0answers
27 views

Store history data using customization features of a profesionnal software

Context My company uses a system that has access to the state of different items in the plant. This software can be customized, by executing a single VBScript function, at a given interval. The ...
2
votes
0answers
536 views

C# MySQL Database Library

Below is a database manager and a class called database connection. The database Manager controls the database connection string and generates a new database connection when you need one. I'm looking ...
2
votes
0answers
101 views

Fetch object from database, or fetch it using an API if it isn't there

To give some background on this particular code, there is a controller which recieves an object, hashes parts of it and looks into a database to see if there is a similar hash in the db, if there is, ...
2
votes
0answers
54 views

Updating a table when a process ends

I have the following piece of code. I would like to be able to combine my first big block if statement inside my while loop and clean up my usage of variables since I'm doing a lot of setting. I've ...
2
votes
0answers
1k views

Firebase many to many relationship structure

I'm trying to create a logical and scalable many to many relationship data structure in Firebase. A user can authenticate with Facebook/Google, upload 3 photos, and a video. Users can also "star" ...
2
votes
0answers
853 views

Inserting large datasets into SQLite db becomes very slow over time

I'm using the program below to insert values from very large .csv files (~2.5 million lines) into an SQLite DB. It starts very fast, but begins to slow over time, before eventually hanging ...
2
votes
0answers
55 views

Google App Engine - Blog Post & User Profile Handler

I am currently developing a web app that lets users submit posts and replies, and they can have their own profile which lists all the submitted posts and replies. I am also using X-AppEngine to fetch ...
2
votes
0answers
118 views

REST web service to interface with a customer database

In what ways could I improve this? Does it look good? Any security concerns? I am using Jersey, Jackson and JPA. What about the architecture? I basically have ...
2
votes
0answers
85 views

Query for searching for the best transportation

I made a website where is possible to search for the best transportation from a place to another. For instance, if I need to go from Berlin to Bremen, the website will search in its internal database ...
2
votes
0answers
60 views

Fantasy league tracker for Game of Thrones

So I've just started learning about MySQL and PHP to create a fantasy league tracker for Game of Thrones for my office. I got it to technically work fine, but I think it's way clunkier than it has to ...
2
votes
0answers
66 views

Minimizing database overhead by storing additional information to the users authentication-object (Spring Security)

I am using Spring Security in order to check if a logged in user is authenticated. However, after authentication, as some actual requests come in, I would like to minimize the number of database calls ...
2
votes
0answers
136 views

Controller method to add a product, stored across three database tables

I have some questions on how I can improve this "add" action method in a controller. Using a single form, the user can upload a product to be displayed on the site. A Product is composed of three ...
2
votes
0answers
758 views

Clean reading of HTML table with R

I have some data under an HTML format and would like to import it in R. However, it seems that type inference is much less sophisticated than what exists with functions such as read.table. I am using ...
2
votes
0answers
50 views

Auto-expire key/value database (with different key types) in Haskell using acid-state

I am making a key-value database using acid-state. It has three similar "pools", one for cookie records, one for email verification of new accounts, and the last for resetting passwords. There are ...
2
votes
0answers
94 views

Bitcoin, detecting deposits to the node.js server

I'm trying to detect deposits that a user will make. I added explainatory comments inline. Can you spot any flaws in it? ...
2
votes
0answers
447 views

Structure of database model for a Flask project

I'm working on a project with Flask and I'm trying to follow Miguel Grinberg's Flask tutorial as closely as possible while creating what I need for my own project. Overall, how does it look? Miguel's ...
2
votes
0answers
321 views

In-memory data cache architecture

I am designing a basic in-memory cache storage with a thin CRUD (actually CRD) interface. The design is inspired by backend solutions such as Parse and StackMob. Main characteristics: Cache consists ...
1
vote
0answers
22 views

Scalable and Optimised group chat system

I have a simple chat system. I have built this to scale so I would appreciate optimisation tips or alternative table structures too. This does not include the pub/ sub queue system. Users ...