Skip to content

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

@mperreir

Description

@mperreir

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 :-(.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions