zillow / ctds

Python DB-API 2.0 library for MS SQL Server
MIT License
83 stars 12 forks source link

How to use alternative schema besides dbo? #71

Closed brdhunga closed 3 years ago

brdhunga commented 3 years ago

For example if I have a schema 'Raw' where the tables lives, how do i specify that?

ATLJoeReed commented 3 years ago

I've not used this library in a while, but I looked at my code, and I'm doing bulk_inserts (https://github.com/zillow/ctds/blob/master/doc/bulk_insert.rst), and the first parameter is the table to insert into. I just used the below pattern to specify the table.

bulk_insert_table = f"{schema}.{table}"

Also, just a plug for the library, this is blazing fast. I'm sure I will be using this library again in the future. Thank you, Zillow!

HuangRicky commented 3 years ago

this is a generic question abour db names. you can reference a table DB.schema.TB by following method:

if you current db is DB, and default schema is schema, just use TB

DB..TB DB.schema.TB schema.TB

so, i always use the full name DB.schema.TB so i never had the issue you have. i highly recommend you do the same.

this has little to do with ctds.

On Wed, Oct 21, 2020, 10:09 PM brdhunga notifications@github.com wrote:

For example if I have a schema 'Raw' where the tables lives, how do i specify that?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zillow/ctds/issues/71, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWEAWL6HHIUFMEXBCW42NDSL6H3ZANCNFSM4S2RNX7A .

joshuahlang commented 3 years ago

Seems as though the question was answered. I'm going to resolve this.