# Pymssql and python-sql error: alias not allowed in update insert query

**URL:** https://discuss.tryton.org/t/pymssql-and-python-sql-error-alias-not-allowed-in-update-insert-query/5534
**Category:** Developer
**Tags:** python-sql
**Created:** [September 15, 2022, 9:55am UTC](https://discuss.tryton.org/t/pymssql-and-python-sql-error-alias-not-allowed-in-update-insert-query/5534 "2022-09-15T09:55:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mboscolo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/mboscolo/32/781_2.png) [@mboscolo](https://discuss.tryton.org/u/mboscolo)
#### Post date: [September 15, 2022, 9:55am UTC](https://discuss.tryton.org/t/pymssql-and-python-sql-error-alias-not-allowed-in-update-insert-query/5534/1 "2022-09-15T09:55:04Z")

</div>

Using the module python-sql with pymssql give an error in case of insert or update query.

there is any way to disable alias for for update and insert ?

Thanks in advance  
Matteo

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 15, 2022, 11:16am UTC](https://discuss.tryton.org/t/pymssql-and-python-sql-error-alias-not-allowed-in-update-insert-query/5534/2 "2022-09-15T11:16:12Z")

</div>

[https://hg.tryton.org/python-sql/rev/66e664b07bd3](https://hg.tryton.org/python-sql/rev/66e664b07bd3) remove the usage of alias for the columns.  
What is exactly the problem?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 15, 2022, 11:29am UTC](https://discuss.tryton.org/t/pymssql-and-python-sql-error-alias-not-allowed-in-update-insert-query/5534/3 "2022-09-15T11:29:44Z")

</div>

I see MSSQL does not support the `as` in `INSERT INTO ... AS ...`.  
I guess it should be possible to add an option to the `AliasManager` to use the table name as alias and than to skip the `AS ...` part in the query.  
This could be activated by a flavor option.

---

<div class="post-metadata">

### Author: ![mboscolo](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/mboscolo/32/781_2.png) [@mboscolo](https://discuss.tryton.org/u/mboscolo)
#### Post date: [September 15, 2022, 11:47am UTC](https://discuss.tryton.org/t/pymssql-and-python-sql-error-alias-not-allowed-in-update-insert-query/5534/4 "2022-09-15T11:47:50Z")

</div>

Dear Ced,  
thanks for the info, I’m not able to set the Flavor

```auto
from sql import *
from sql.aggregate import *
from sql.conditionals import *
r_lav_order = Table('RigheOrdineLavorazioneVersoLantek')
i=r_lav_order.insert()
i
<sql.Insert object at 0x7f3fcfc77b30>
tuple(i)
('INSERT INTO "RigheOrdineLavorazioneVersoLantek" AS "a" DEFAULT VALUES', ())
Flavor.set(Flavor(no_as=True))
tuple(i)
('INSERT INTO "RigheOrdineLavorazioneVersoLantek" AS "a" DEFAULT VALUES', ())

```

and could you give me some advice on how to

> option to the `AliasManager` to use the table name as alias

really thanks for your time

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [September 15, 2022, 11:54am UTC](https://discuss.tryton.org/t/pymssql-and-python-sql-error-alias-not-allowed-in-update-insert-query/5534/5 "2022-09-15T11:54:29Z")

</div>

What I talked does not exist. There is no flavor for that.  
The `no_as` flavor is for Oracle which does not support the keyword `AS` when define an alias.
