Skip to content

Commit 79237c2

Browse files
Check to see if tables should be declared, add case for unprivilged branch with fks.
1 parent 0a239dc commit 79237c2

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

datajoint/schemas.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def _decorate_table(self, table_class, context, assert_declared=False):
222222
# instantiate the class, declare the table if not already
223223
instance = table_class()
224224
is_declared = instance.is_declared
225-
if not is_declared:
225+
if not is_declared and not assert_declared and self.create_tables:
226226
instance.declare(context)
227227
self.connection.dependencies.clear()
228228
is_declared = is_declared or instance.is_declared

tests/schema_privileges.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,10 @@ class NoAccess(dj.Lookup):
2626
definition = """
2727
string: varchar(10)
2828
"""
29+
30+
31+
@schema
32+
class NoAccessAgain(dj.Manual):
33+
definition = """
34+
-> NoAccess
35+
"""

tests/test_blob.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def test_insert_longblob():
230230

231231
def test_datetime_serialization_speed():
232232
# If this fails that means for some reason deserializing/serializing
233-
# np arrays of np.datetime64 types is now slower than regular arrays of datetime64
233+
# np arrays of np.datetime64 types is now slower than regular arrays of datetime
234234

235235
optimized_exe_time = timeit.timeit(
236236
setup="myarr=pack(np.array([np.datetime64('2022-10-13 03:03:13') for _ in range(0, 10000)]))",
@@ -247,4 +247,4 @@ def test_datetime_serialization_speed():
247247
)
248248
print(f"python time {baseline_exe_time}")
249249

250-
assert optimized_exe_time * 1000 < baseline_exe_time
250+
assert optimized_exe_time * 900 < baseline_exe_time

0 commit comments

Comments
 (0)