Skip to main content

Questions tagged [sqlalchemy]

SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.

Filter by
Sorted by
Tagged with
2 votes
1 answer
37 views

Type-agnostic configuration-table in sqlalchemy

I'm building my first bigger database-backend with sqlalchemy and need a table to store configurations (key-value pairs). Keys are strings, values can be quite different, and I'd like to keep the ...
FooBar's user avatar
  • 193
2 votes
1 answer
63 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 "...
Doruk's user avatar
  • 361
1 vote
1 answer
104 views

Managing users via SQLAlchemy DB model (updated)

I am currently in the process of writing a system application that will be operated by multiple users. This will require individual users to access the application while limiting access to those that ...
Michael's user avatar
  • 303
1 vote
0 answers
56 views

A server side for a Premier League score guessing app

So I'm writing a Premier League score prediction app with Python, Flask and SQLalchemy and have almost finished the server side of it. I realised that no one has ever looked at my code and there could ...
Adam's user avatar
  • 11
1 vote
1 answer
116 views

Getting one company from two tables [closed]

Currently I'm working with fastapi, sqlalchemy to connect to multiple databases. It checks params to ensure it has company_name, ...
g3tl0st's user avatar
  • 111
1 vote
0 answers
97 views

YouTube to LBRY Video Uploader - V0.1.0

I have developed a Python script that allows users to upload videos from YouTube to LBRY. The script also performs video post-processing and database operations. I would like to request a code review ...
Walid Mujahid وليد مجاهد's user avatar
2 votes
2 answers
549 views

DDD architecture pattern

I'm trying to understand the DDD architecture pattern. I wrote a simple project in which I tried to use DDD arch. Here are my doubts after implementing it: Does it make sense to use an ORM for a DDD ...
Minipami's user avatar
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 ...
javanoob's user avatar
  • 183
0 votes
1 answer
213 views

Retrieve, parse and export data to tables via sqlalchemy

The project I've working on is designed with the intent of being able to quickly and efficiently identify discrepancies in live sports betting data that comes from web API's in json format. The first ...
Nick's user avatar
  • 103
0 votes
1 answer
101 views

User, Company, Company User and Post relationship

The use case of an application is there will be two kinds of user. One normal user and another company user. The requirement is Normal user can follow company and see their posts A company has ...
Serenity's user avatar
  • 201
2 votes
1 answer
169 views

Many to many relationship in Flask with SQLAlchemy

I want to create a family tree where the relationships are only godfather and godson. Is this the right way to declare the personn class ? ...
louisld's user avatar
  • 153
0 votes
1 answer
192 views

Flask-SQLAlchemy achieve 1 to many relationship that backfills parent when child is updated

Currently I have two tables Plan (plans) and User (users) and there is a foreign key constraint on users which references plans.id When I create a new user I want to assign a plan to that user via ...
H B's user avatar
  • 1
1 vote
1 answer
186 views

Inserting Data to three linked table with SQLAlchemy

I am inserting data from a dict type object into three different tables in the SQL database. I am using Sqlalchemy as my ORM. My code is working but I think it is not very readable, is it any way to ...
Kartikeya Sharma's user avatar
2 votes
1 answer
132 views

Linking a count to an object in SQLAlchemy

I'm not sure if the problem here is how I'm wording the question or going about finding an answer, but I have what I think is a relatively trivial task: getting fact-check claims from the Google Fact ...
n1c9's user avatar
  • 501
1 vote
0 answers
624 views

Discord bot using SQLAlchemy

Right now I'm making a Discord Bot written in Python. I'm using SQLAlchemy to deal with the database. My structure is: One database.py containing a ...
Lizzie's user avatar
  • 11
1 vote
1 answer
148 views

Filtering data from an exisiting table using psycopg2+sqlalchemy

I am using psycopg2 & sqlalchemy to connect to a database and extract information from a table as follows: ...
some_programmer's user avatar
3 votes
1 answer
113 views

Flask Database Design with ORM

I am designing a Stock Currency application and for that, I created a database. I searched for my question here first but the answerer told me to ask the same question here. ...
alkanstein's user avatar
2 votes
0 answers
29 views

A task to store user's favorited projects in postgres using python

I am not happy with two functions calling get_user() since while testing I mock get_user and to test with get_user_returns_null case, it returns Null for both ...
technazi's user avatar
  • 195
1 vote
1 answer
784 views

How to make the filtering queries more efficient using flask sqlalchemy?

I have a following table in a flask app ...
reinhardt's user avatar
  • 133
6 votes
2 answers
258 views

Follow Up DinoPass - CLI Password Manager

This is a follow-up (somewhat) to this post. I said somewhat because I've kinda changed most of the logic. Changes: I've changed the project name I've changed the CLI UX I've added encryption / ...
Grajdeanu Alex's user avatar
2 votes
0 answers
74 views

Basic flask template with sessions

This Flask app, which makes use of SQLAlchemy, a MySQL server which is only reachable via SSH and Flask-Login, is the base on which I want to write an application which has login protected pages. ...
Woask's user avatar
  • 125
1 vote
0 answers
239 views

querying users from table if user.id is found in another table

I am using flask with sqlAlchemy to connect with a postgresql database with two tables Users table (id, name) ...
Hadi's user avatar
  • 111
1 vote
0 answers
70 views

Python: SQL Alchemy. Managing a many-to-many self related table

I am building Twitter. People can follow each other, and hence I have 2 tables, users and followers. My current problem is ...
GRS's user avatar
  • 111
6 votes
3 answers
1k views

Simple Python and SQLAlchemy Text Password Manager

Out of boredom, I decided to start my personal project and I've chosen a simple Text Password Manager. Note: For anyone out there, I strongly recommend you NOT to use this for any sensitive storage ...
Grajdeanu Alex's user avatar
2 votes
0 answers
42 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: ...
Ciasto piekarz's user avatar
3 votes
0 answers
299 views

Is this a good way to process SQLAlchemy's uniqueness constraint violation in Flask?

I'm using Flask along with Flask-SQLAlchemy and Flask-WTF. I have a model: ...
art-solopov's user avatar
2 votes
1 answer
132 views

Website for allowing data evaluation from submission

I'm making a really basic website where users essentially just submit data into some forms and they will be able to review their data in another page. I feel like I'm going to be repeating myself far ...
nat643's user avatar
  • 45
3 votes
0 answers
220 views

Code organization: interacting with SQLAlchemy from inside class

I don't like the way my code is written, but at the moment, I don't see, how I should do it better. I have a class (let's say MyInvoiceType), which needs to save data to preexisting database. The ...
Gnudiff's user avatar
  • 230
1 vote
0 answers
321 views

Setting up user models with Flask-SQLAlchemy

I've recently come across SQLAlchemy, and as I had just been attempting to code something very similar to it, I think it's amazing. I've started on a new website, ...
Peter's user avatar
  • 1,125
2 votes
0 answers
270 views

Saving OAuth2 credentials to database with SQLAlchemy

I'm writing web application that uses Google Proximity Beacon API to interact with beacon data. In order to access that data, I need to grant access to use beacons' information for my web application ...
devaerial's user avatar
  • 121
3 votes
0 answers
126 views

Loading into a target table

Today I tried Bonobo + SQLAlchemy (for the first time), so it's bound to be full of bad practices. However, this is working code. I'm hoping for some feedback to for doing it correctly. I started out ...
svenema's user avatar
  • 139
3 votes
2 answers
142 views

Finding the duration of how long a search has been popular

Program: I have designed a program in python that does the following (in order): Webscrapes google trends for the most popular searches Stores the searches and traffic of the searches in an in-memory ...
Ranch Mayonaise's user avatar
7 votes
2 answers
2k views

A simple library using Flask and SQLAlchemy

This is the main.py script that does most of the work of Adding movies (Movie objects) as well as modifying and removing: ...
Tristo's user avatar
  • 173
3 votes
1 answer
2k views

Slow Flask-SQLAlchemy query using association tables

I have two models in Flask-SQLAlchemy (Post and Comment) that have many-to-many relationship that is manifested in the third model (post_mentions): ...
Richard Feynman's user avatar
3 votes
0 answers
379 views

Flask-SQLAlchemy model structure

I'm seeking a review of my Flask-SQLAlchemy model structure, particularly adherence to DB best practices, such as avoiding duplication, etc. The models represent the relations between Departments, ...
DavidSaucony's user avatar
2 votes
1 answer
87 views

SQLAlchemy code for calling parameters

I'm using the following function to process API parameters for an specific endpoint. Using SQLAlchemy and Flask, I want to get feedback in terms of simplifying calling SQL code and nested statements. ...
gogasca's user avatar
  • 611
2 votes
0 answers
151 views

REST backend app script for doing CRUD transactions

As a side project, I am working on Tiddly which is a simple Python(Flask) based app for a generic REST backend that could be used for CRUD transactions on any kind of database (using ...
Prahlad Yeri's user avatar
1 vote
1 answer
431 views

Get json format from sqlalchemy class

I have written a small tool to generate a json file from sqlalchemy models files to automate the tedious procedure of writing all the sql raws in a json format. The script works, but there are few ...
diegus's user avatar
  • 229
2 votes
1 answer
218 views

SqlAlchemy model for users and timezones

I have a following schema, I would like to query user and all timezones belongs to it including timezone name. Could you please validate if my schema constructed correctly and most efficient way? <...
Wild Goat's user avatar
  • 191
4 votes
0 answers
292 views

SQL-Alchemy session management

I have written a couple of scripts for accessing Twitter REST API, and storing data in a Postgres DB for data extraction purposes. I know how to use django ORM, or plain SQL, but this was my first ...
latusaki's user avatar
  • 251
3 votes
0 answers
169 views

Constructing queries with SQLAlchemy based on search parameters

I have an app where the user can search for items in my database by entering a set of information, then the server receives it and for each option it queries the database, and stores the result in a ...
Anis Souames's user avatar
2 votes
1 answer
666 views

Saving items to database w/ sqlalchemy

Can someone please review my code? I'm saving a hotel rate to a database. I want to save the rate twice, one field will update with every new rate, and one field will contain the rate that was found ...
caseym's user avatar
  • 199
1 vote
0 answers
1k views

Parse query filter expression from request URL

I am building a backend APi for which I need to extract query filters from request URL of following pattern: ...
Sohaib Farooqi's user avatar
3 votes
0 answers
2k views

Simple Payment System Flask App

Can I please get some reviews and suggestions? This is what this app does: It picks user login from Users table and compare it with the post in the login ...
saviour123's user avatar
3 votes
1 answer
4k views

Applying dynamic filters to a SQL query using Python conditional expressions

I wrote this piece of code to eliminate the need for multiple if then statements based on the filters from the incoming REST request. If the request has category ...
HackToHell's user avatar
3 votes
1 answer
299 views

SQLite database for a micro/tumble blog application

I'm creating a personal website where, among other things, there is a blog, or a "microblog" (I'm still not sure how to define the two), where I will be writing articles and having users, who will ...
Sean Pianka's user avatar
3 votes
0 answers
338 views

Implementing Flask create_app function with SqlAlchemy

I have a simple Flask app that realises rest-api with SQLAlchemy. I have written this create_app function: views.py ...
ig-melnyk's user avatar
  • 151
3 votes
1 answer
3k views

Generating string primary keys with sequence in SQLAlchemy

I need improvement on solution to the following problem: Generating random string keys in SQA is relatively simple, something like: ...
LetMeSOThat4U's user avatar
3 votes
1 answer
1k views

Utility Class for CRUD Operations in a Flask App

I'm new to Flask and Python and am trying to sort out the most pythonic way to modularize my utilities. I have models.py which have my sqlalchemy models and ...
ThatTechGuy's user avatar
1 vote
1 answer
83 views

Add user to a database and perform relevant checks

Below is a function that adds a new user to the database using their email and password. I am using Flask and SQLAlchemy. ...
user avatar