Skip to content

TAIL is handled as a non-standard COPY TO statement #2305

@timcash

Description

@timcash

Trying to get node-postgres working with a streaming database that uses the postgres protocol. From the docs I cut a section and added it below. Having trouble getting it to work. Does this driver support something like cursor.copy_expert("TAIL some_materialized_view", sys.stdout)?

In terms of the pgwire protocol, TAIL is handled as a non-standard COPY TO statement. As long as your driver lets you send your own COPY statement to the running Materialize node, you can TAIL updates from Materialize anywhere you’d like.
#!/usr/bin/env python3

import sys
import psycopg2

def main():

    dsn = 'postgresql://localhost:6875/materialize?sslmode=disable'
    conn = psycopg2.connect(dsn)

    with conn.cursor() as cursor:
        cursor.copy_expert("TAIL some_materialized_view", sys.stdout)

if __name__ == '__main__':
    main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions