Skip to content

Commit

Permalink
Merge pull request #1913 from OpenEnergyPlatform/housekeeping-remove-…
Browse files Browse the repository at this point in the history
…deprecated-references-module

Remove deprecated references module
  • Loading branch information
jh-RLI authored Dec 4, 2024
2 parents 274fd9e + 25bac0d commit 9debbef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 262 deletions.
23 changes: 0 additions & 23 deletions api/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,29 +671,6 @@ def parse_scolumnd_from_columnd(schema, table, name, column_description):
}


def parse_sconstd_from_constd(schema, table, name_const, constraint_description):
defi = constraint_description.get("definition")
return {
"action": None, # {ADD, DROP}
"constraint_type": constraint_description.get(
"constraint_typ"
), # {FOREIGN KEY, PRIMARY KEY, UNIQUE, CHECK}
"constraint_name": name_const,
"constraint_parameter": constraint_description.get("definition")
.split("(")[1]
.split(")")[0],
# Things in Brackets, e.g. name of column
"reference_table": defi.split("REFERENCES ")[1].split("(")[2]
if "REFERENCES" in defi
else None,
"reference_column": defi.split("(")[2].split(")")[1]
if "REFERENCES" in defi
else None,
"c_schema": schema,
"c_table": table,
}


def replace_None_with_NULL(dictonary):
# Replacing None with null for Database
for key, value in dictonary.items():
Expand Down
230 changes: 0 additions & 230 deletions api/references.py

This file was deleted.

17 changes: 8 additions & 9 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ def post(self, request, schema, table):
elif "constraint" in json_data["type"]:
# Input has nothing to do with DDL from Postgres.
# Input is completely different.
# Using actions.parse_sconstd_from_constd is not applicable
# dict.get() returns None, if key does not exist
constraint_definition = {
"action": json_data["action"], # {ADD, DROP}
Expand Down Expand Up @@ -968,10 +967,10 @@ def get(self, request, schema, table, row_id=None):
content_type="text/csv",
session=session,
)
response[
"Content-Disposition"
] = 'attachment; filename="{schema}__{table}.csv"'.format(
schema=schema, table=table
response["Content-Disposition"] = (
'attachment; filename="{schema}__{table}.csv"'.format(
schema=schema, table=table
)
)
return response
elif format == "datapackage":
Expand Down Expand Up @@ -999,10 +998,10 @@ def get(self, request, schema, table, row_id=None):
content_type="application/zip",
session=session,
)
response[
"Content-Disposition"
] = 'attachment; filename="{schema}__{table}.zip"'.format(
schema=schema, table=table
response["Content-Disposition"] = (
'attachment; filename="{schema}__{table}.zip"'.format(
schema=schema, table=table
)
)
return response
else:
Expand Down
2 changes: 2 additions & 0 deletions versions/changelogs/current.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Migrate from django version 3.2 to 5.1 [(#1884)](https://github.com/OpenEnergyPlatform/oeplatform/pull/1884).

- Removed the outdated & unmaintained references module that was intended to handle bibtex files and store them in a django model [(#1913)](https://github.com/OpenEnergyPlatform/oeplatform/pull/1913).

## Features

## Bugs
Expand Down

0 comments on commit 9debbef

Please sign in to comment.