Skip to content

Commit

Permalink
export properly, fix extra paren
Browse files Browse the repository at this point in the history
  • Loading branch information
erikerlandson committed Oct 28, 2021
1 parent f31378e commit 749b5bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions osc_ingest_trino/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
# defines the release version for this python package
__version__ = "0.1.0"

from .sqlcols import *
from .sqltypes import *

__all__ = [
"sql_compliant_name",
"enforce_sql_column_names",
"pandas_type_to_sql",
"create_table_schema_pairs",
]

7 changes: 6 additions & 1 deletion osc_ingest_trino/sqlcols.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import re
import pandas as pd

__all__ = [
"sql_compliant_name",
"enforce_sql_column_names",
]

_wsdedup = re.compile(r"\s+")
_usdedup = re.compile(r"__+")
_rmpunc = re.compile(r"[,.()&$/+-]+")
Expand Down Expand Up @@ -36,6 +41,6 @@ def enforce_sql_column_names(df, inplace=False, maxlen=63):
ocols = sql_compliant_name(icols, maxlen=maxlen)
if (len(set(ocols)) < len(ocols)):
raise ValueError("remapped column names were not unique!")
rename_map = dict(list(zip(icols, ocols))))
rename_map = dict(list(zip(icols, ocols)))
return df.rename(columns=rename_map, inplace=inplace)

5 changes: 5 additions & 0 deletions osc_ingest_trino/sqltypes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import pandas as pd

__all__ = [
"pandas_type_to_sql",
"create_table_schema_pairs",
]

_p2smap = {
'string': 'varchar',
'float32': 'real',
Expand Down

0 comments on commit 749b5bf

Please sign in to comment.