On Dec 4, 2012, at 6:27 PM, Derek Harland wrote:

> 
> Yes
> 
>> In that case, how does SQL server make the distinction?
> 
> If things have an embedded "." then SQL server would ideally make the 
> distinction based on you quoting the database/schema names.  This could be 
> done in the Transact-SQL manner:
> 
>   [database].[example.schema.with.dots].[table]
> 
> or via ANSI sql quoting.
> 
>   "database"."example.schema.with.dots"."table"
> 
> The MSSQL dialect currently quotes identifiers using the T-SQL standard
> 
>> If the DB has:
>> 
>> database A -> schema B -> table C
>> database DEFAULT -> schema A.B -> table C
>> 
>> then what does SQL server consider "A.B.C" to mean ?
> 
> By default, unless any identifier is quoted then A.B.C will be read to mean 
> database.schema.table.  ie database A -> schema B -> table C.
> 
> To path to the latter you'd need to use [A.B].C or "A.B".C.

So, the quotes are *required* in order for SQL Server to see that "A.B" is the 
schemaname, right ?   Meaning, "<database>.<schema>" is the default, "<schema 
with dots>" is the exception case.   

In that case, a schema name with a dot in it is not supported at all right now 
- unless you embedded quotes into it (doesn't SQL Server use [] for quotes 
also?)   I'm not sure how this is a regression - are you saying that a schema 
name with a dot in it *does* work in 0.7 and is interpreted as just schema name?

The key here is that SQL server I am assuming is *not* doing logic like, "check 
for DBname A, if not present then assume schema name is 'A.B'".

> 
> Personally, if I call get_view_names(..., schema="A.B") ... I'd expect it to 
> be looking in schema A.B in the current database.  If I wanted to look in 
> another database I'd expect to be calling something like get_view_names(..., 
> schema="B", dbname="A") probably.

The "schema" parameter has for a while now supported the idea of allowing 
dotted names to be present, and while it is called "schema", it really means, 
"dotted qualifier for the Table".   For example when you use it with SQLite, 
that's not a "schema", its a different database file setup using ATTACH.    

So right now, we have users using Table like this:

Table("mytable", metadata, schema="dbname.schemaname")

and that works in 0.7 as well, it's just reflection that doesn't work there.   
And since we know that "A.B.C" without extra quotes means 
"dbname.schema.table", the interpretation of "schema" as "dbname.schemaname" is 
not new at all in 0.8.    With quotes required, the feature of supporting a 
schema name with a dot in it is not supported at all in 0.7 either.

Support for schema names with dots in them seems like it would entirely be a 
feature add.     Let's take it over to 
http://www.sqlalchemy.org/trac/ticket/2626.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to