Skip to content

Complete the seatabler migration: queries and row writes - #21

Open
alexanderbates wants to merge 2 commits into
mainfrom
asb-seatabler-writes
Open

Complete the seatabler migration: queries and row writes#21
alexanderbates wants to merge 2 commits into
mainfrom
asb-seatabler-writes

Conversation

@alexanderbates

@alexanderbates alexanderbates commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #20, completing the migration using seatabler 0.2.0's write
generics and 0.2.2's column coercion. Around 375 lines out of banc-table.R,
with no change to any banctable_* name, signature or default.

Moved across

  • banctable_update_rows() -> seatabler::seatable_update_rows()
  • banctable_append_rows() -> seatabler::seatable_append_rows(), which
    handles the big-data path itself, so bigdata = TRUE no longer needs bancr's
    own REST call
  • banctable_query() -> seatabler::seatable_query()
  • banc_df2updatepayload() and banctable2df() retired

That removes the last fafbseg::: internal from banc-table.R. Defaults are
preserved, including append_allowed = FALSE (seatabler's own default is
TRUE), bigdata = FALSE, and limit = FALSE meaning "no LIMIT clause".

Reads are unchanged

banctable_query() was the piece held back, because seatable_query() did not
apply column types until seatabler 0.2.2 (flyconnectome/seatabler#9, now fixed
and confirmed). Checked against a snapshot taken before the switch, 500 rows of
banc_meta:

  • same 163 columns, in the same order
  • identical values for root_id, status and cell_type on every row
  • status stays character, so banc_update_status() and the string handling
    around it are unaffected

Five number columns (input_connections, output_connections,
mitochondria, mitochondria_volume, cell_ids_id) now come back as integer
rather than numeric, because st_fix_coltypes() compares mode() and
mode(integer) is "numeric". No effect on values: across 3000 rows the
largest is 3,773,658 against a 2^31 limit, and anything larger would arrive from
pandas as a double rather than overflowing. Recorded on seatabler#9 rather than
worked around here.

Fixes a latent bug

Multiple-select columns were comma-split by hand, so a value that itself
contained a comma was silently broken into two options. seatabler detects
multi-select from the table schema and passes whole values.

Test coverage gap closed

New test-seatabler.R reaches seatable_module() and banctable_login(),
skipping without a token. Worth having: bancr's suite passed cleanly while a
stale nat.python made every SeaTable call fail, because nothing exercised that
path. That is also why #20 needed a seatabler version pin.

Testing

  • Full suite: 23 pass, 0 fail, 2 skip, against seatabler 0.2.2.
  • Live write round-trip on a throwaway base on cloud.seatable.io: append three
    rows, update them, verify the new values, delete them, back to the starting
    row count with no leftovers.
  • Nothing written to banc_meta or cns_meta at any point; the read checks
    above are read-only.

Requires seatabler (>= 0.2.2). Version 0.3.8.

seatabler 0.2.0 added seatable_update_rows() and seatable_append_rows(), the
generics banctable_update_rows() / banctable_append_rows() were waiting on. Both
now delegate, dropping another ~215 lines. Names, signatures and defaults are
unchanged, including append_allowed = FALSE and bigdata = FALSE.

Multiple-select columns are now detected from the table schema by seatabler
rather than comma-split by hand here, which also fixes a latent bug: a
multi-select value containing a comma used to be split into two options.

banctable_query() deliberately keeps bancr's own row conversion.
seatable_query() does not apply column types, so delegating it today would
change 11 of 163 column classes on banc_meta: status and cell_type_source
become list columns, _ctime/_mtime lose POSIXct, and two number columns arrive
as character. Reported as flyconnectome/seatabler#9; the switch waits on that.

Adds a test that reaches seatable_module() and banctable_login(). bancr's suite
previously passed even with a seatabler that could not reach its Python
dependencies, because nothing exercised that path -- a stale nat.python broke
every SeaTable call while the tests stayed green.

Round-tripped against a throwaway base on cloud.seatable.io: append three rows,
update them, delete them, back to the starting row count with no leftovers.
Nothing was written to banc_meta or cns_meta. Full suite 23 pass, 0 fail.

Claude-Session: https://claude.ai/code/session_01TQHvpdwd2XCozxU6bKhRWQ
seatabler 0.2.2 applies column types from the table schema (st_coerce_df), which
was the one thing keeping banctable_query()'s row conversion here. It now
delegates like the rest, and banctable2df() retires with it. That removes the
last fafbseg::: internal from banc-table.R.

Reads are unchanged, checked against a snapshot taken before the switch on 500
rows of banc_meta: same 163 columns in the same order, and identical values for
root_id, status and cell_type across every row. status stays character, so
banc_update_status() and the string handling around it are unaffected.

Five number columns (input_connections, output_connections, mitochondria,
mitochondria_volume, cell_ids_id) come back as integer rather than numeric,
because st_fix_coltypes() compares mode() and mode(integer) is "numeric". No
effect on values: the largest across 3000 rows is 3.8 million against a 2^31
limit, and anything larger would arrive from pandas as a double anyway. Noted
on flyconnectome/seatabler#9 rather than worked around here.

limit = FALSE is still honoured, mapped to an infinite limit. `ac` stays in the
signature and is ignored, as with the other wrappers.

Requires seatabler (>= 0.2.2). Full suite 23 pass, 0 fail.

Claude-Session: https://claude.ai/code/session_01TQHvpdwd2XCozxU6bKhRWQ
@alexanderbates alexanderbates changed the title Delegate row writes to seatabler 0.2.0 Complete the seatabler migration: queries and row writes Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant