Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error 500 when using links on many to many relation #5

Open
mperreir opened this issue Mar 27, 2021 · 0 comments
Open

error 500 when using links on many to many relation #5

mperreir opened this issue Mar 27, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@mperreir
Copy link

Considering the following DB schema

CREATE TABLE IF NOT EXISTS "Genres" (
	"genreId"	TEXT,
	"genreName"	TEXT,
	"genreDesc"	TEXT,
	PRIMARY KEY("genreId")
);

CREATE TABLE IF NOT EXISTS "Artists" (
	"artistId"	TEXT,
	"artistName"	TEXT,
	"artistPhoto"	TEXT,
	"genreRef"	TEXT,
	PRIMARY KEY("artistId"),
	FOREIGN KEY("genreRef") REFERENCES "Genres"("genreId")
);

CREATE TABLE IF NOT EXISTS "SimilarTo" (
	"artist1Ref"	TEXT,
	"artist2Ref"	TEXT,
	PRIMARY KEY("artist1Ref","artist2Ref"),
	FOREIGN KEY("artist1Ref") REFERENCES "Artists"("artistId"),
	FOREIGN KEY("artist2Ref") REFERENCES "Artists"("artistId")
);

CREATE TABLE IF NOT EXISTS "Labels" (
	"labelId"	TEXT,
	"labelName"	TEXT,
	PRIMARY KEY("labelId")
);

CREATE TABLE IF NOT EXISTS "Songs" (
	"songId"	TEXT,
	"songTitle"	TEXT,
	"songLength"	NUMERIC,
	PRIMARY KEY("songId")
);

CREATE TABLE IF NOT EXISTS "AppearsOn" (
	"albumRef"	TEXT,
	"songRef"	TEXT,
	PRIMARY KEY("albumRef","songRef"),
	FOREIGN KEY("albumRef") REFERENCES "Albums"("albumId"),
	FOREIGN KEY("songRef") REFERENCES "Songs"("songId")
);

CREATE TABLE IF NOT EXISTS "ParticipateTo" (
	"artistRef"	TEXT,
	"albumRef"	TEXT,
	 FOREIGN KEY("artistRef") REFERENCES "Artists"("artistId"),
	FOREIGN KEY("albumRef") REFERENCES "Albums"("albumId")
);

CREATE TABLE IF NOT EXISTS "Albums" (
	"albumId"	TEXT,
	"albumYear"	INTEGER,
	"albumTitle"	TEXT,
	"albumImage"	TEXT,
	"labelRef"	TEXT,
	"genreRef"	TEXT,
	PRIMARY KEY("albumId"),
	FOREIGN KEY("labelRef") REFERENCES "Labels"("labelId"),
	FOREIGN KEY("genreRef") REFERENCES "Genres"("genreId")
);

Trying to access /artists/id_of_artist/albums raises a 500 error. The exact error is sqlalchemy filter complaining about Artistsnot belonging to itsmodelparameter. The problem seems to come fromqs2sqla.pybut it is hard to find exactly why without taking time to understandflask_autocrud` inner working :-(.

@cs91chris cs91chris added the bug Something isn't working label Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants