Comments (2)
The issue is that table names from SHOW TABLES
(e.g. DBO.TABLENAME) are lowercased by DatabaseIntrospection.identifier_converter()
(dbo.tablename) and then later uppercased by DatabaseOperations.quote_name()
which also performs quoting of periods ("DBO"."TABLENAME").
This patch seemed to work for me to introspect a table with a dot in the name:
diff --git a/django_snowflake/introspection.py b/django_snowflake/introspection.py
index 36dff42..c8064f3 100644
--- a/django_snowflake/introspection.py
+++ b/django_snowflake/introspection.py
@@ -194,7 +194,7 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
cursor.execute('SHOW TABLES')
tables = [
TableInfo(
- self.identifier_converter(row[1]), # table name
+ '"' + row[1] + '"', # table name
't', # 't' for table
row[5], # comment
) for row in cursor.fetchall()
output:
class DboTablename(models.Model):
col1 = models.BigIntegerField(blank=True, null=True)
class Meta:
managed = False
db_table = '"DBO.TABLENAME"'
but only use it temporarily while running inspectdb! A proper solution needs more thought, likely as part of #43.
from django-snowflake.
Thanks for looking into this. However, this patch appears to be working only when running inspectdb on the whole database.
python manage.py inspectdb --database snowflake
But not when inspecting one specific table
python manage.py inspectdb --database snowflake DBO.TABLE
python manage.py inspectdb --database snowflake 'DBO.TABLE'
python manage.py inspectdb --database snowflake '"DBO.TABLE"'
from django-snowflake.
Related Issues (20)
- Add support for introspecting lower case identifiers
- ERROR in RawQueryset [Raw SQL ]
- Error: The session does not have a current database HOT 7
- Unable to use the connector with external browser authentication HOT 1
- Switch to REGEXP_INSTR to avoid implicit anchoring
- Use last_query_id when retrieving last_insert_id HOT 2
- JSONField queries with complex JSON parameters don't work
- Consider changing NAME to DB_NAME HOT 2
- Option private_key does not work when launching SnowSQL HOT 3
- ROLE should be a top level config HOT 3
- instead of last_insert_id, can we set "can_return_columns_from_insert" as False? HOT 2
- Document how to authenticate with a private key HOT 1
- Datetime should be Timestamp_ntz HOT 6
- Persistent DB connection (a la `CONN_MAX_AGE`) HOT 5
- Receiving 'Error detecting the version of libcrypto' when connecting to Django HOT 1
- Slow performance HOT 3
- authenticator:externalbrowser issue HOT 3
- "The error was: too many values to unpack (expected 11)" while running inspectdb HOT 4
- Backport fix for crash in `DatabaseIntrospection.get_table_description()` to Django 3.2.x HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-snowflake.