Lose the schema??

15 views
Skip to first unread message

Victor Manuel Arévalo Fandiño

unread,
Jun 21, 2021, 4:34:43 PM6/21/21
to sqlalchemy
Hello

I'm trying to insert a row in a table but I have the message:
"No se pudo realizar el insert en Tbl_cataloging_meeting:(<class 'sqlalchemy.exc.ProgrammingError'>, ProgrammingError('(pypyodbc.ProgrammingError) (\'42000\', \'[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot find the object "SCHEMA__none.tbl_cataloging_meeting" because it does not exist or you do not have permissions.\')'), <traceback object at 0x000002393E47B540>)"
I don't understand the reason of this message because I can write in other table before, this is a fragment of my code:

def make_inserts(self):
self.insert_tbl_act_template(self.list_tbl_act_template)
self.insert_tbl_cataloging_meeting(self.list_tbl_cataloging_meeting)
-----------------------------------------------------------------------------
def insert_tbl_cataloging_meeting(self, cataloging_meeting_register):
try:
if cataloging_meeting_register is not None:
self.__session.add(cataloging_meeting_register)
self.__session.commit()
return cataloging_meeting_register
except:
mesagge = "No se pudo realizar el insert en Tbl_cataloging_meeting:" + str(sys.exc_info())
print(mesagge)
return None

When call self.insert_tbl_act_template the insert is commited but self.insert_tbl_cataloging_meeting doesn't work. Really I don't understand the problemm.
the echo of sqlalchemy show me this:

2021-06-21 15:05:31,235 INFO sqlalchemy.engine.Engine INSERT INTO [PRESIDENCY_DATA].tbl_act_template (ate_name, ate_description, ate_resume, ate_type_field, ate_is_valid, ate_created_at, ate_updated_at, ate_deleted_at, ate_creator_id, ate_updater_id, ate_deleter_id, ate_file) OUTPUT inserted.ate_id VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2021-06-21 15:05:31,235 INFO sqlalchemy.engine.Engine [generated in 0.00151s] ('City Council meeting minutes', 'City Council meeting minutes', None, None, 0, datetime.datetime(2020, 8, 17, 8, 28, 55, 560000), datetime.datetime(2020, 8, 17, 8, 28, 55, 560000), datetime.datetime(2020, 8, 24, 16, 40, 22, 370000), 1167, 1167, 1167, 'Plantilla Acta.rdlx')
2021-06-21 15:05:31,241 INFO sqlalchemy.engine.Engine COMMIT
2021-06-21 15:05:31,245 INFO sqlalchemy.engine.Engine BEGIN (implicit)
2021-06-21 15:05:31,250 INFO sqlalchemy.engine.Engine SELECT [PRESIDENCY_DATA].tbl_act_template.ate_id AS tbl_act_template_ate_id, [PRESIDENCY_DATA].tbl_act_template.ate_name AS tbl_act_template_ate_name, [PRESIDENCY_DATA].tbl_act_template.ate_description AS tbl_act_template_ate_description, [PRESIDENCY_DATA].tbl_act_template.ate_resume AS tbl_act_template_ate_resume, [PRESIDENCY_DATA].tbl_act_template.ate_type_field AS tbl_act_template_ate_type_field, [PRESIDENCY_DATA].tbl_act_template.ate_is_valid AS tbl_act_template_ate_is_valid, [PRESIDENCY_DATA].tbl_act_template.ate_created_at AS tbl_act_template_ate_created_at, [PRESIDENCY_DATA].tbl_act_template.ate_updated_at AS tbl_act_template_ate_updated_at, [PRESIDENCY_DATA].tbl_act_template.ate_deleted_at AS tbl_act_template_ate_deleted_at, [PRESIDENCY_DATA].tbl_act_template.ate_creator_id AS tbl_act_template_ate_creator_id, [PRESIDENCY_DATA].tbl_act_template.ate_updater_id AS tbl_act_template_ate_updater_id, [PRESIDENCY_DATA].tbl_act_template.ate_deleter_id AS tbl_act_template_ate_deleter_id, [PRESIDENCY_DATA].tbl_act_template.ate_file AS tbl_act_template_ate_file
FROM [PRESIDENCY_DATA].tbl_act_template
WHERE [PRESIDENCY_DATA].tbl_act_template.ate_id = ?
2021-06-21 15:05:31,250 INFO sqlalchemy.engine.Engine [generated in 0.00039s] (59,)
2021-06-21 15:05:37,829 INFO sqlalchemy.engine.Engine SET IDENTITY_INSERT [SCHEMA__none].tbl_cataloging_meeting ON
2021-06-21 15:05:37,829 INFO sqlalchemy.engine.Engine ()
2021-06-21 15:05:37,830 INFO sqlalchemy.engine.Engine ROLLBACK
No se pudo realizar el insert en Tbl_cataloging_meeting:(<class 'sqlalchemy.exc.ProgrammingError'>, ProgrammingError('(pypyodbc.ProgrammingError) (\'42000\', \'[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot find the object "SCHEMA__none.tbl_cataloging_meeting" because it does not exist or you do not have permissions.\')'), <traceback object at 0x000002393E47B540>)

I appreciate some help.

best regards
Víctor Manuel Arévalo Fandiño

Mike Bayer

unread,
Jun 21, 2021, 5:50:58 PM6/21/21
to noreply-spamdigest via sqlalchemy
you have a Table that defines "schema" as "SCHEMA__none", and this schema does not exist.

--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.

Mike Bayer

unread,
Jun 21, 2021, 5:58:07 PM6/21/21
to noreply-spamdigest via sqlalchemy
OK more specifically you seem to be using the "schema_translate_map" feature and  but for some reason SQLAlchemy is also  attempting to manipulate the IDENTITY INSERT feature, which normally should not be happening, and in this case it appears there may be a bug in the SQL Server dialect that does not correctly combine "schema_translate_map" with IDENTITY INSERT.

however there is no reason IDENTITY INSERT should be changing here, I would need to see the "CREATE TABLE" for this table as well as what your Table metadata looks like.

Mike Bayer

unread,
Jun 21, 2021, 6:06:58 PM6/21/21
to noreply-spamdigest via sqlalchemy

though your program should not have to use the IDENTITY INSERT feature and we need to see your schema / Table.

Victor Manuel Arévalo Fandiño

unread,
Jun 22, 2021, 1:09:35 PM6/22/21
to sqlalchemy
Yes, in my insert function I had a value in the IDENTITY field (catmet_id), I became None and everything works ok (my mistake)

Thank you very much.
Sin título.png
Reply all
Reply to author
Forward
0 new messages