1) Some progress has been made on the "support schemas" ticket lately, and I
believe that completing that ticket may affect the way this feature is
implemented. For example, with good schema support, it seems reasonable to
take one argument -- the name of the schema to introspect. I'd hesitate to
accept the feature as suggested without considering such possibilities.
2) In order to be useful to you, it is not enough to introspect the models --
you need to be able to use them as well. That is, essentially, ticket 6148
without migrations, unless I am missing something.
b) Add a test that introspects a table from another schema. On Oracle,
creating tables in another schema is probably too hard to do in a test, but
you can try to introspect views from INFORMATION_SCHEMA (with a little care
and luck, you may even be able to write a test that should work on all
backends, as INFORMATION_SCHEMA is standardized).
3) 1.9 is feature-frozen at this point -- its beta is out already. Even if the
feature is accepted as-is, it would need to target 1.10.
Are you doing something like "inspectdb other.a other.b" or "inspectdb a b"?
Beyond that -- the attitude we've always taken with inspectdb is to just make
it get all the tables, and let the user delete models they don't need (the
output is usually not exactly correct anyway).
To make it clear: I (and Josh, AFAICT) was not responding about an option to
limit the set of tables introspected, but about an option to introspect tables
which weren't introspected before. If your intention is to just limit, that's
a different story.
And I'm sorry if I make it seem complicated -- the reservation I have is that
I think selecting schemas to introspect would be more useful than selecting
tables, and so I don't want the positional arguments to be "captured" for
tables.
In that case, are you sure what you're offering is a solution and not just a
workaround? Shouldn't we make it so that inspectdb always gets all the tables
in the schema?
>
> My intention is just that, to be able to limit what tables are introspected
> when inspectdb is launched, regardless of what has been inspected before.
>
What do you thunk of Tim Allen's suggestion:
./manage.py inspectdb --tables=form_*,user_*
In my opinion current behavior is just fine.
On 04.11.2015 18:26, Shai Berger wrote:
On Wednesday 04 November 2015 16:46:35 José Tomás Tocino García wrote:
Now I get it. There are tables in your schema, which are not owned by you.Are you doing something like "inspectdb other.a other.b" or "inspectdb aThe latter. Given a single database (and the default schema), my patch
b"?
allows to just inspect tables "a" and "b".
Frankly, I wasn't aware this was possible.
The problem is what I mentioned in my first message, the currentIn that case, are you sure what you're offering is a solution and not just a
implementation of inspectdb fails to get all the tables and views when the
user does not own them.
workaround? Shouldn't we make it so that inspectdb always gets all the tables
in the schema?
My intention is just that, to be able to limit what tables are introspectedWhat do you thunk of Tim Allen's suggestion:
when inspectdb is launched, regardless of what has been inspected before.
./manage.py inspectdb --tables=form_*,user_*
Thanks for your patience in this,
Shai.
--
You received this message because you are subscribed to a topic in the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-developers/CuczZovhp74/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/563B087F.3090607%40gmail.com.
In my opinion current behavior is just fine.
How is it "just fine" if there are usecases (the one I've described, for instance) where the current behavior evidently doesn't cut it?
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAAOwDo5ACkgXcwig1dpd4u_mdDPCe9gvfNyHue%2BbyNaN1n-qog%40mail.gmail.com.
Well first, inspectdb does only processes tables. As I understood your case involves views which are not traversed by Django.
Secondly, how often inspectdb is required to run with just a subset? Tim' suggestion is quite nice (wildcarded query).
Then we hit edge cases, since Django models by default are read/write how should select-only tables (or views if such behavior is implemented) should be handled? Should there be overridden methods that tries to disable invalid actions?
Now we hit another thing. If you do have spatial fields your schema will get temporary spatial objects, MDRT_*. Then usecase would be getting all other except those MDRT_* tables (or maybe exclude all tables having *$*)
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAAOwDo7eG913Y_5Ch1iv7J1WeVU_7bGpft%3DNSsiqj-GB%3DTa2GA%40mail.gmail.com.
Well first, inspectdb does only processes tables. As I understood your case involves views which are not traversed by Django.
Are you sure about that? inspectdb calls connection.introspection.table_names(cursor) that, in the case of Oracle, calls oracle.introspection.DatabaseIntrospection.get_table_list which queries BOTH tables AND views:
"""Returns a list of table and view names in the current database."""cursor.execute("SELECT TABLE_NAME, 't' FROM USER_TABLES UNION ALL ""SELECT VIEW_NAME, 'v' FROM USER_VIEWS")
Maybe that view thing as been changed along the years.My proposal would be allow two switches, inclusion and exclusion with a wildcard. Where exclusion would override any inclusion.I guess that would satisfy most of the use cases. How that sounds?
Maybe that view thing as been changed along the years.My proposal would be allow two switches, inclusion and exclusion with a wildcard. Where exclusion would override any inclusion.
I guess that would satisfy most of the use cases. How that sounds?
As I already stated before, filtering using wildcards is not going to make it for me, because in my case I don't get a list of available tables in the first place (because the current introspection mechanism doesn't return tables not owned by the user).
--
José Tomás Tocino García
http://www.josetomastocino.com
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To post to this group, send email to django-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAAOwDo7J33ScxGvQ3UZe2HLMLbc1Eim1TPGwqFDap6Xdp%2BJkFw%40mail.gmail.com.
Well maybe extending queries to do that. Wonder is there similiar issues with postgresql?
postgres=# CREATE DATABASE permissions;CREATE DATABASEpostgres=# \c permissions;You are now connected to database "permissions" as user "postgres".permissions=# create table foo (id int, name varchar(255));CREATE TABLEpermissions=# GRANT CONNECT ON DATABASE permissions to tester;GRANTpermissions=# GRANT USAGE ON SCHEMA public TO tester;GRANTpermissions=# GRANT SELECT ON foo TO tester;GRANTpermissions=# \q(ENV)vagrant@vagrant-ubuntu-trusty-64:~$ ./manage.py inspectdb# This is an auto-generated Django model module.# You'll have to do the following manually to clean this up:# * Rearrange models' order# * Make sure each model has one field with primary_key=True# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table# Feel free to rename the models, but don't rename db_table values or field names.## Also note: You'll have to insert the output of 'django-admin sqlcustom [app_label]'# into your database.from __future__ import unicode_literalsfrom django.db import modelsclass Foo(models.Model):id = models.IntegerField(blank=True, null=True)name = models.CharField(max_length=255, blank=True, null=True)class Meta:managed = Falsedb_table = 'foo'
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/9acc3506-6585-4dd6-9463-0d431707e441%40googlegroups.com.