Skip to content

V25.0 #6

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

Merged
merged 4 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ pip install git+https://github.com/mimesis-inria/SimulationSimpleDatabase.git

# Option 2 (DEVS): install as editable
$ git clone https://github.com/mimesis-inria/SimulationSimpleDatabase.git
$ cd SimRender
$ cd SimulationSimpleDatabase
$ pip install -e .
```

Expand Down
2 changes: 1 addition & 1 deletion docs/src/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Install with *pip*

.. code-block:: bash

$ pip install git+https://github.com/mimesis-inria/SimulationSimpleDatabase.git
pip install git+https://github.com/mimesis-inria/SimulationSimpleDatabase.git

Then, you should be able to run:

Expand Down
13 changes: 8 additions & 5 deletions src/SSD/core/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,23 @@ def __new_fields(self,
field_name, field_type = field[0], field[1]
field_default = '_null_' if len(field) == 2 else field[2]

# As peewee.Model creates a new attribute named field_name, check that this attribute does not exist
if field_name in [m[0] for m in getmembers(table)]:
raise ValueError(f"Tried to create a field '{field_name}' in the Table '{table_name}'. "
f"You are not allowed to create a field with this name, please rename it.")

# Extend the Table
if field_name not in table.fields():

# As peewee.Model creates a new attribute named field_name, check that this attribute does not exist
if field_name in [m[0] for m in getmembers(table)]:
raise ValueError(f"Tried to create a field '{field_name}' in the Table '{table_name}'. "
f"You are not allowed to create a field with this name, please rename it.")

# FK
if type(field_type) == str:
if (fk_table_name := self.make_name(field_type)) not in self.__tables.keys():
raise ValueError(f"Cannot create the ForeignKey '{fk_table_name}' since this Table does not"
f"exists. Created Tables so far: {self.__tables.keys()}")
table.extend_fk(self.__tables[fk_table_name], field_name)
self.__fk[table_name][field_name] = fk_table_name

# Standard field
else:
table.extend(field_name, field_type, field_default)

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy