--- title: "How do I write query results to LUSID with the writer designer?" slug: "how-do-i-write-query-results-to-lusid-with-the-writer-designer" updated: 2026-11-24T13:59:14Z published: 2026-11-24T13:59:14Z canonical: "support.lusid.com/how-do-i-write-query-results-to-lusid-with-the-writer-designer" --- > ## Documentation Index > Fetch the complete documentation index at: https://support.lusid.com/llms.txt > Use this file to discover all available pages before exploring further. # How do I write query results to LUSID with the writer designer? Once a query returns the right rows, loading them into LUSID is one more step. Writer providers such as `Lusid.Portfolio.Txn.Writer` and `Lusid.Instrument.Equity.Writer` create, update and delete data, and the writer designer in the Luminesce Query Editor matches your query's columns to the writer's fields for you, so you can load a file of trades or a set of instruments without writing the mapping by hand. Writes change real data Running the generated query writes to LUSID straight away. Check the query, and try it on a few rows first. ## Prerequisites - Access to the Luminesce Query Editor in the LUSID web app, under **Data Virtualisation > Query Editor**. - Permission to use the writer provider, and to change the data it writes. See [Query Editor permissions reference](/v1/docs/query-editor-permissions-reference). - A query that returns the rows you want to write, for example one that reads a file with the [file designer](/v1/docs/how-do-i-read-a-file-with-the-file-designer). ## Methods ### Method 1: Write a query's results 1. Put the query in the editor, then select the writer designer on the toolbar. You can also select **Writer Designer** in the query designer or the file designer. 2. In **Selected writer**, choose the writer, such as `Lusid.Portfolio.Txn.Writer`. The list holds every writer you have permission to use. 3. The table lists each of the writer's fields under **Writer field**. Hover over a field's information icon for its description. Wherever one of your columns has the same name as a field, ignoring case, spaces, underscores and hyphens, the designer has already mapped it in **Map**. 4. Map the rest. For each field, choose one of your columns in **Map**, or type an expression, such as `'Upsert'` for a `WriteAction` field or `upper(Currency)`. To build a longer expression, select the row and use the editor beside the table; **Easy Case** helps you write a `case` expression. Leave a field empty to leave it out of the write. 5. Select **Generate SQL**. ![](https://cdn.document360.io/d575ad81-c0ed-4980-bbd1-d59ac5c3de82/Images/Documentation/image(981).png?sv=2026-02-06&spr=https&st=2026-11-24T15%3A05%3A08Z&se=2026-11-24T16%3A05%3A08Z&sr=b&sp=r&sig=yATOtOrhGpJy31XqSJ1Fde65rdxjHpJJ0Vx8NSwe10U%3D) The designer changes your query so that it: - Returns one column per mapped field, named after the field, for example `TradeDate as [TransactionDate]`. - Puts those rows in a table variable, `@write`, if they aren't in one already. - Ends with `select * from [Lusid.Portfolio.Txn.Writer] where [ToWrite] = @write;`, which does the writing. Run the query. The writer returns a row for each row it wrote; check its `WriteErrorCode` and `WriteError` columns for any that failed. ### Method 2: Let Candela choose the writer and mapping Select **Writer Designer assistant**. Candela suggests the writer best suited to your data and a mapping for its fields. Apply its mapping from its reply, then check every field before you generate the SQL. To go back to the designer's own matching, select **Reset to defaults**. Candela availability Candela is currently available to some customers only. If it isn't available in your domain, you don't see **Writer Designer assistant**. ### Method 3: Change an existing write Open the writer designer on a query that already writes, such as one it generated. Change the writer or the mapping and select **Generate SQL**. The designer replaces the existing write rather than adding a second one. ## Troubleshooting ### Generate SQL is greyed out Choose a writer in **Selected writer**. ### The writer returns errors for some rows Read `WriteError` on those rows. Common causes are a required field left unmapped, a value of the wrong type, or a missing `WriteAction`. To see which fields a writer needs, see its page under [Providers](/v1/docs/providers). ### A writer isn't in the list You don't have permission to use it. Ask your LUSID administrator. ## Related articles - [How do I read a file with the file designer?](/v1/docs/how-do-i-read-a-file-with-the-file-designer) - [How do I use the Luminesce query designer?](/v1/docs/how-do-i-use-the-luminesce-query-designer) - [Using Luminesce to write different kinds of property for LUSID entities](/v1/docs/using-luminesce-to-write-different-kinds-of-property-for-lusid-entities)