Skip to content

Insert Jobs From SQL? #1005

Description

@thezachdrake

Is there way to insert jobs with raw SQL from any language? The docs only mention the Python and Ruby libraries. It would be awesome to let any service in any language insert jobs with SQL and then let the Go engine work them.

Activity

  1. brandur commented on Aug 10, 2025

    @brandur
    Contributor

    Good point, it's pretty plausible to insert jobs via any SQL with something like this:

    INSERT INTO river_job (
        kind,
        args,
        max_attempts
    ) values (
        'fake_job',
        '{}',
        10
    );
    
    SELECT pg_notify('river_insert', '{"queue":"default"}');

    That's the core set of fields without defaults on the columns, but you can of course do additional customization on properties like priority, queue, metadata, tags, etc.

    Note though that the unique logic is quite complicated, so unique jobs won't be usable without a fairly well-vetted client library.

  2. thezachdrake commented on Aug 11, 2025

    @thezachdrake
    Author

    This is helpful thank you!

  3. locked and limited conversation to collaborators on Aug 11, 2025
  4. converted this issue into a discussion #1006 on Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions