# How to define a Vapor route to retrieve MySQL table columns names

**URL:** <https://forums.swift.org/t/how-to-define-a-vapor-route-to-retrieve-mysql-table-columns-names/82257>\
**Category:** Vapor\
**Created:** [September 20, 2025, 4:18pm UTC](https://forums.swift.org/t/how-to-define-a-vapor-route-to-retrieve-mysql-table-columns-names/82257 "2025-09-20T16:18:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JPM](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@JPM](https://forums.swift.org/u/JPM)\
**Post date:** [September 20, 2025, 4:18pm UTC](https://forums.swift.org/t/how-to-define-a-vapor-route-to-retrieve-mysql-table-columns-names/82257/1 "2025-09-20T16:18:53Z")

</div>

I want to define a route to retrieve my table columns names.

This code (embedded in app.get("table-columns") ):

```swift
let tableName = Vocabulario.schema

```

```swift
let query = SQLQueryString("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = `\(unsafeRaw: tableName)` ")

```

```swift
let rows = try await sql.raw(query).all()

```

```swift
let columns: [String] = rows.compactMap { row in

```

```swift
 return try? row.decode(column: "COLUMN_NAME", as: String.self)

```

```swift
}

```

```swift
 return columns

```

generates a MySQL error: Server error: Unknown column 'Vocabulario' **in**'WHERE'.

I know there are no columns having the same name of the table . So any idea on whats wrong?
