(self, connection, table_name, schema=None, **kw)
| 2980 | |
| 2981 | @reflection.cache |
| 2982 | def _get_table_sql(self, connection, table_name, schema=None, **kw): |
| 2983 | if schema: |
| 2984 | schema_expr = "%s." % ( |
| 2985 | self.identifier_preparer.quote_identifier(schema) |
| 2986 | ) |
| 2987 | else: |
| 2988 | schema_expr = "" |
| 2989 | try: |
| 2990 | s = ( |
| 2991 | "SELECT sql FROM " |
| 2992 | " (SELECT * FROM %(schema)ssqlite_master UNION ALL " |
| 2993 | " SELECT * FROM %(schema)ssqlite_temp_master) " |
| 2994 | "WHERE name = ? " |
| 2995 | "AND type in ('table', 'view')" % {"schema": schema_expr} |
| 2996 | ) |
| 2997 | rs = connection.exec_driver_sql(s, (table_name,)) |
| 2998 | except exc.DBAPIError: |
| 2999 | s = ( |
| 3000 | "SELECT sql FROM %(schema)ssqlite_master " |
| 3001 | "WHERE name = ? " |
| 3002 | "AND type in ('table', 'view')" % {"schema": schema_expr} |
| 3003 | ) |
| 3004 | rs = connection.exec_driver_sql(s, (table_name,)) |
| 3005 | value = rs.scalar() |
| 3006 | if value is None and not self._is_sys_table(table_name): |
| 3007 | raise exc.NoSuchTableError(f"{schema_expr}{table_name}") |
| 3008 | return value |
| 3009 | |
| 3010 | def _get_table_pragma(self, connection, pragma, table_name, schema=None): |
| 3011 | quote = self.identifier_preparer.quote_identifier |
no test coverage detected