-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support to mysql databases #165
Conversation
Mysql and co: accept connect_timeout keyword sqlite: accepts timeout keyword
tangos/core/creator.py
Outdated
@@ -10,11 +10,11 @@ class Creator(Base): | |||
__tablename__ = 'creators' | |||
|
|||
id = Column(Integer, primary_key=True) | |||
command_line = Column(String) | |||
command_line = Column(String(128)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about this, in particular the command_line
may be longer than 128 character. Should it be a Text
instead?
Note that this change is necessary for MySQL/MariaDB databases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I suppose it should be Text
. In sqlite
I think TEXT
and VARCHAR
are identical so this change should not cause any problems
tangos/core/creator.py
Outdated
cwd = Column(String) | ||
host = Column(String(128)) | ||
username = Column(String(128)) | ||
cwd = Column(String(128)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This perhaps should also be Text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting to turn host
and username
to Text
fields as well?
tangos/core/simulation.py
Outdated
@@ -18,7 +18,7 @@ class Simulation(Base): | |||
# __table_args__ = {'useexisting': True} | |||
|
|||
id = Column(Integer, primary_key=True) | |||
basename = Column(String) | |||
basename = Column(String(128)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text here too
tangos/core/simulation.py
Outdated
@@ -111,7 +111,7 @@ class SimulationProperty(Base): | |||
data_float = Column(Float) | |||
data_int = Column(Integer) | |||
data_time = Column(DateTime) | |||
data_string = Column(String) | |||
data_string = Column(String(128)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text here too
tangos/core/timestep.py
Outdated
@@ -14,7 +14,7 @@ class TimeStep(Base): | |||
__tablename__ = 'timesteps' | |||
|
|||
id = Column(Integer, primary_key=True) | |||
extension = Column(String) | |||
extension = Column(String(128)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text here too
Otherwise this breaks the unique-ness of the entry
MySQL does not support ForeignKeys in temporary tables, so here we disable it if the table creation failed. Note that the table will be deleted when the current context is left.
The actual accuracy depends on the number of significative numbers in the database
…ke execution path more transparent
Refactor argmax logic into a generic function
The ambiguous order is probably what is causing intermittent failures of * test_live_calculation_link_syntax.test_missing_link * test_live_calculation_link_syntax.test_multi_calculation_link_returned_halo_is_usable with MySQL running on Github actions
…ing MySQL failures
* clarify inheritance path for Halo, BH, Tracker etc, to make clear that many relationships do not overlap * explicitly flag a few remaining relationships that overlap
Use the LONGBLOB type in MySQL to store up to 2**32 (4GiB) bytes instead of up to 2**16 (65kb)
Only TANGOS_DB_CONNECTION should be used by users.
…entation The proper argmax implementation is needed within relation_finding to make it work with MySQL (and probably other databases), but uses a large join which can hit performance (~10x degredation for complicated searches) The performance on e.g. large tree searches is now similar (though still a few percent worse than) the older, buggy code
tangos/testing/__init__.py
Outdated
engine = create_engine(db_url) | ||
with engine.connect() as conn: | ||
conn.execute("COMMIT") | ||
# Do not substitute user-supplied database names here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand this comment, what's it saying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a leftover from a previous version, I'm going to delete it.
@@ -103,6 +106,7 @@ def test_link_returned_halo_is_usable(): | |||
|
|||
def test_multi_calculation_link_returned_halo_is_usable(): | |||
all_links = db.get_timestep("sim/ts1").calculate_all('link(testlink)') | |||
print("returned -->",all_links[0][0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print statement to be removed
I fixed a performance issue and have left two ultra-minor comments above - as soon as they are done I think this is good to merge. Hooray! |
This brings back support to non-sqlite databases.
Notably, this allows to run the database on one server with the data on another.
TODO:
TANGOS_