mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Remove table renaming from connect(), instead require 'from pokedex.db.oracle import *' followed by 'rewrite_long_table_names()';
This commit is contained in:
parent
33d2940b1b
commit
6c0074b1a5
2 changed files with 1 additions and 11 deletions
|
@ -6,7 +6,6 @@ from sqlalchemy import engine_from_config, orm
|
|||
from ..defaults import get_default_db_uri
|
||||
from .tables import Language, metadata
|
||||
from .multilang import MultilangSession, MultilangScopedSession
|
||||
from .oracle import rewrite_long_table_names, restore_long_table_names
|
||||
|
||||
ENGLISH_ID = 9
|
||||
|
||||
|
@ -46,15 +45,6 @@ def connect(uri=None, session_args={}, engine_args={}, engine_prefix=''):
|
|||
if 'auto_setinputsizes' not in uri:
|
||||
uri += '?auto_setinputsizes=FALSE'
|
||||
|
||||
# Shorten table names, Oracle limits table and column names to 30 chars
|
||||
# Easy solution : drop the vowels, differents words are unlikely to
|
||||
# end up the same after the vowels are gone
|
||||
rewrite_long_table_names(metadata.tables)
|
||||
else:
|
||||
restore_long_table_names(metadata.tables)
|
||||
|
||||
|
||||
|
||||
### Connect
|
||||
engine_args[engine_prefix + 'url'] = uri
|
||||
engine = engine_from_config(engine_args, prefix=engine_prefix)
|
||||
|
|
|
@ -138,7 +138,7 @@ def load(session, tables=[], directory=None, drop_tables=False, verbose=False, s
|
|||
table_names = _get_table_names(metadata, tables)
|
||||
table_objs = [metadata.tables[name] for name in table_names]
|
||||
|
||||
# Oracle fixery again, load doesn't know we modified the schema
|
||||
# Oracle fixery, load needs short names
|
||||
# flag for oracle stuff
|
||||
oranames = (session.connection().dialect.name == 'oracle')
|
||||
if oranames:
|
||||
|
|
Loading…
Reference in a new issue