Skip to content

Conversation

@deep1401
Copy link
Member

@deep1401 deep1401 commented Dec 4, 2025

  • Allows setting a config per-user per-team or per-team
  • Verified downloading and training models across different teams (one with set tokens and one without)

stmt = insert(Config).values(key=key, value=value)
stmt = stmt.on_conflict_do_update(index_elements=["key"], set_={"value": value})
async def config_set(
key: str, value: str, user_id: str | None = None, team_id: str | None = None, team_wide: bool = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the team_wide bool as a parameter? Isn't team_wide implicit if user_id is null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed now. It was essentially for global configs but we're saying those dont exist right now so I removed this

Copy link
Member

@dadmobile dadmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't dig into it but I got an error running the migration (only included relevant lines):

INFO  [alembic.runtime.migration] Running upgrade 1f7cb465d15a -> c78d76a6d65c, add_team_id_to_config_table
...
  File "/Users/tony/.transformerlab/envs/transformerlab/lib/python3.11/site-packages/sqlalchemy/sql/compiler.py", line 7262, in visit_null
    raise exc.CompileError(
sqlalchemy.exc.CompileError: Can't generate DDL for NullType(); did you forget to specify a type on this Column?

The above exception was the direct cause of the following exception:
...
  File "/Users/tony/workspace/transformerlab-app/api/alembic/versions/c78d76a6d65c_add_team_id_to_config_table.py", line 45, in upgrade
    with op.batch_alter_table("config", schema=None) as batch_op:
...
    raise exc.CompileError(
sqlalchemy.exc.CompileError: (in table '_alembic_tmp_config', column 'key'): Can't generate DDL for NullType(); did you forget to specify a type on this Column?

Migration output: Using default home directory: /Users/tony/.transformerlab

@deep1401
Copy link
Member Author

deep1401 commented Jan 7, 2026

I didn't dig into it but I got an error running the migration (only included relevant lines):

INFO  [alembic.runtime.migration] Running upgrade 1f7cb465d15a -> c78d76a6d65c, add_team_id_to_config_table
...
  File "/Users/tony/.transformerlab/envs/transformerlab/lib/python3.11/site-packages/sqlalchemy/sql/compiler.py", line 7262, in visit_null
    raise exc.CompileError(
sqlalchemy.exc.CompileError: Can't generate DDL for NullType(); did you forget to specify a type on this Column?

The above exception was the direct cause of the following exception:
...
  File "/Users/tony/workspace/transformerlab-app/api/alembic/versions/c78d76a6d65c_add_team_id_to_config_table.py", line 45, in upgrade
    with op.batch_alter_table("config", schema=None) as batch_op:
...
    raise exc.CompileError(
sqlalchemy.exc.CompileError: (in table '_alembic_tmp_config', column 'key'): Can't generate DDL for NullType(); did you forget to specify a type on this Column?

Migration output: Using default home directory: /Users/tony/.transformerlab

I cant reproduce but the error seems to come from doing alter_table in a batch op. I tried to fix, could you try again once?

@dadmobile
Copy link
Member

I didn't dig into it but I got an error running the migration (only included relevant lines):

INFO  [alembic.runtime.migration] Running upgrade 1f7cb465d15a -> c78d76a6d65c, add_team_id_to_config_table
...
  File "/Users/tony/.transformerlab/envs/transformerlab/lib/python3.11/site-packages/sqlalchemy/sql/compiler.py", line 7262, in visit_null
    raise exc.CompileError(
sqlalchemy.exc.CompileError: Can't generate DDL for NullType(); did you forget to specify a type on this Column?

The above exception was the direct cause of the following exception:
...
  File "/Users/tony/workspace/transformerlab-app/api/alembic/versions/c78d76a6d65c_add_team_id_to_config_table.py", line 45, in upgrade
    with op.batch_alter_table("config", schema=None) as batch_op:
...
    raise exc.CompileError(
sqlalchemy.exc.CompileError: (in table '_alembic_tmp_config', column 'key'): Can't generate DDL for NullType(); did you forget to specify a type on this Column?

Migration output: Using default home directory: /Users/tony/.transformerlab

This is fixed!

Copy link
Member

@dadmobile dadmobile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like weights and biases key always saves as a team-wide key. I think you are already looking into this.

Copy link
Member Author

@deep1401 deep1401 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like weights and biases key always saves as a team-wide key. I think you are already looking into this.

Fixed now it was there for everything

@dadmobile
Copy link
Member

It looks like weights and biases key always saves as a team-wide key. I think you are already looking into this.

Fixed now it was there for everything

OK this works!

A funny thing is it gives you the option to set user or team even when you are in single user mode. But let's not worry about that right now and maybe fix in a followup or something.

@deep1401 deep1401 merged commit 32bcf3e into main Jan 8, 2026
8 checks passed
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.

5 participants